@@ -49,7 +49,19 @@ endif()
49
49
50
50
# We only differentiate between MSVC and GCC-compatible compilers
51
51
if (MSVC )
52
- set (LTM_C_FLAGS -W3 )
52
+ if (CMAKE_C_COMPILER_ID STREQUAL "Clang" )
53
+ # We are clang-cl
54
+ # Some flags for linux similarity and warnings
55
+ set (LTM_C_FLAGS -fstrict-aliasing /W3 /D_CRT_SECURE_NO_WARNINGS )
56
+ # Optimization flags
57
+ set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zc:inline /Gw /Gy /clang:-funroll-loops" )
58
+ # Pass optimization option to override the debug flags, and allow dead code elimination
59
+ set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /clang:-O1" )
60
+ # We need to link the runtime for 128 bit int support, which clang-cl has
61
+ link_libraries (clang_rt.builtins-x86_64.lib )
62
+ else ()
63
+ set (LTM_C_FLAGS /W3 /D_CRT_SECURE_NO_WARNINGS )
64
+ endif ()
53
65
elseif (WATCOM )
54
66
set (LTM_C_FLAGS -fo=.obj -oaxt -3r -w3 )
55
67
else ()
63
75
endif ()
64
76
65
77
# What compiler do we have and what are their...uhm... peculiarities
66
- if (CMAKE_C_COMPILER_ID MATCHES "(C|c?)lang" )
78
+ if (CMAKE_C_COMPILER_ID MATCHES "(C|c?)lang" AND NOT MSVC )
67
79
list (APPEND LTM_C_FLAGS -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header )
68
80
# Clang requires at least '-O1' for dead code elimination
69
81
set (CMAKE_C_FLAGS_DEBUG "-O1 ${CMAKE_C_FLAGS_DEBUG} " )
@@ -97,7 +109,7 @@ add_library(${PROJECT_NAME}
97
109
98
110
target_include_directories (${PROJECT_NAME} PUBLIC
99
111
$< BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} >
100
- $< INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} / ${PROJECT_NAME} >
112
+ $< INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >
101
113
)
102
114
103
115
target_compile_options (${PROJECT_NAME} BEFORE PRIVATE
0 commit comments