Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build when using clang-cl on Windows #129

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DYNAMICBASE")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DYNAMICBASE")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /guard:cf")
# enable Spectre Mitigation
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qspectre")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qspectre")
# enable Spectre Mitigation, not supported by clang-cl
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qspectre")
endif()
if(NOT CMAKE_C_COMPILER_ID STREQUAL Clang)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qspectre")
endif()
endif()

#CXX compiler support
Expand Down Expand Up @@ -111,8 +115,10 @@ if(MSVC)
# treat warnings as errors
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX /W3")

# enable multi-process compilation
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
# enable multi-process compilation, not supported by clang-cl
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()

# enable exceptions handling
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
Expand Down
Loading