Created
June 10, 2021 16:26
-
-
Save InfRandomness/d5d1e6e50afffc2633ae76dd59993438 to your computer and use it in GitHub Desktop.
Patch to make CMake 3.20.3 compile with clang-cl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt | |
index 6adc9cf6a8..e147951dd2 100644 | |
--- a/Source/CMakeLists.txt | |
+++ b/Source/CMakeLists.txt | |
@@ -80,6 +80,12 @@ if(CMake_BUILD_DEVELOPER_REFERENCE) | |
) | |
endif() | |
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | |
+ if ("${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") | |
+ ADD_COMPILE_OPTIONS("/EHs") | |
+ endif() | |
+endif() | |
+ | |
# configure the .h file | |
configure_file( | |
"${CMake_SOURCE_DIR}/Source/cmConfigure.cmake.h.in" | |
diff --git a/Utilities/cmjsoncpp/CMakeLists.txt b/Utilities/cmjsoncpp/CMakeLists.txt | |
index 74e998823c..7e378c28f5 100644 | |
--- a/Utilities/cmjsoncpp/CMakeLists.txt | |
+++ b/Utilities/cmjsoncpp/CMakeLists.txt | |
@@ -20,6 +20,12 @@ include_directories( | |
${KWSYS_HEADER_ROOT} | |
) | |
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | |
+ if ("${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC") | |
+ ADD_COMPILE_OPTIONS("/EHs") | |
+ endif() | |
+endif() | |
+ | |
add_library(cmjsoncpp ${JSONCPP_SOURCES}) | |
target_link_libraries(cmjsoncpp ${CMake_KWIML_LIBRARIES}) | |
set_property(TARGET cmjsoncpp PROPERTY CXX_INCLUDE_WHAT_YOU_USE "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment