summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Hieta <tobias@hieta.se>2023-03-16 18:27:16 +0100
committerGitHub <noreply@github.com>2023-03-16 18:27:16 +0100
commit83a7d891dce9d0185be4d65306dd298dcd1620bb (patch)
tree206e4df84180c6f0d3c169c3f8891421d5649c3a
parentfe03859ebe1e5fdf87b02fba3d70f5854124d453 (diff)
downloadccache-83a7d891dce9d0185be4d65306dd298dcd1620bb.tar.gz
build: Make ccache compile with clang-cl on Windows (#1260)
-rw-r--r--cmake/DevModeWarnings.cmake2
-rw-r--r--cmake/StandardSettings.cmake9
-rw-r--r--unittest/CMakeLists.txt2
3 files changed, 7 insertions, 6 deletions
diff --git a/cmake/DevModeWarnings.cmake b/cmake/DevModeWarnings.cmake
index 1ada85f5..1db8135f 100644
--- a/cmake/DevModeWarnings.cmake
+++ b/cmake/DevModeWarnings.cmake
@@ -74,6 +74,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Disable C++20 compatibility for now.
add_compile_flag_if_supported(CCACHE_COMPILER_WARNINGS "-Wno-c++2a-compat")
+ add_compile_flag_if_supported(CCACHE_COMPILER_WARNINGS "-Wno-c99-extensions")
+ add_compile_flag_if_supported(CCACHE_COMPILER_WARNINGS "-Wno-language-extension-token")
# If compiler supports these warnings they have to be disabled for now.
add_compile_flag_if_supported(
diff --git a/cmake/StandardSettings.cmake b/cmake/StandardSettings.cmake
index 9e09ea67..bee457c1 100644
--- a/cmake/StandardSettings.cmake
+++ b/cmake/StandardSettings.cmake
@@ -12,7 +12,7 @@ else()
)
endif()
-if(CMAKE_CXX_COMPILER_ID MATCHES "^GNU|(Apple)?Clang$")
+if(CMAKE_CXX_COMPILER_ID MATCHES "^GNU|(Apple)?Clang$" AND NOT MSVC)
option(ENABLE_COVERAGE "Enable coverage reporting for GCC/Clang" FALSE)
if(ENABLE_COVERAGE)
target_compile_options(standard_settings INTERFACE --coverage -O0 -g)
@@ -55,17 +55,16 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "^GNU|(Apple)?Clang$")
include(StdAtomic)
include(StdFilesystem)
-
-elseif(MSVC)
+elseif(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "^Clang$")
target_compile_options(
standard_settings
- INTERFACE /Zc:preprocessor /Zc:__cplusplus /D_CRT_SECURE_NO_WARNINGS
+ INTERFACE /Zc:preprocessor /Zc:__cplusplus
)
endif()
if(WIN32)
target_compile_definitions(
standard_settings
- INTERFACE WIN32_LEAN_AND_MEAN
+ INTERFACE WIN32_LEAN_AND_MEAN _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS
)
endif()
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
index 2a3edf0d..062961f0 100644
--- a/unittest/CMakeLists.txt
+++ b/unittest/CMakeLists.txt
@@ -49,7 +49,7 @@ list(APPEND source_files ${headers})
add_executable(unittest ${source_files})
-if(MSVC)
+if(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "^Clang$")
# Turn off /Zc:preprocessor for this test because it triggers a bug in some older Windows 10 SDK headers.
set_source_files_properties(test_Stat.cpp PROPERTIES COMPILE_FLAGS /Zc:preprocessor-)
endif()