@@ -49,7 +49,19 @@ endif()
4949
5050# We only differentiate between MSVC and GCC-compatible compilers
5151if (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)
64+ endif ()
5365elseif (WATCOM)
5466 set (LTM_C_FLAGS -fo=.obj -oaxt -3r -w3)
5567else ()
6375endif ()
6476
6577# 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 )
6779 list (APPEND LTM_C_FLAGS -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header)
6880 # Clang requires at least '-O1' for dead code elimination
6981 set (CMAKE_C_FLAGS_DEBUG "-O1 ${CMAKE_C_FLAGS_DEBUG} " )
@@ -97,7 +109,7 @@ add_library(${PROJECT_NAME}
97109
98110target_include_directories (${PROJECT_NAME} PUBLIC
99111 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} >
100- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} / ${PROJECT_NAME} >
112+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >
101113)
102114
103115target_compile_options (${PROJECT_NAME} BEFORE PRIVATE
0 commit comments