summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/PrecompileHeaders
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-05-11 15:56:50 (GMT)
committerBrad King <brad.king@kitware.com>2020-05-11 15:58:41 (GMT)
commit6b2fb4ffd2e34093e54db0d5e2dac0fa17eacdf0 (patch)
tree6de7a9a893a6094135dadf7c8b7e5d75f382494a /Tests/RunCMake/PrecompileHeaders
parent4c82f309c59d02899145bc25c0e9efc91a6f64ed (diff)
downloadCMake-6b2fb4ffd2e34093e54db0d5e2dac0fa17eacdf0.zip
CMake-6b2fb4ffd2e34093e54db0d5e2dac0fa17eacdf0.tar.gz
CMake-6b2fb4ffd2e34093e54db0d5e2dac0fa17eacdf0.tar.bz2
VS: Fix using PCH from source with COMPILE_OPTIONS
If a source file gets per-source flags from both PCH and custom `COMPILE_OPTIONS`, combine them correctly. Fixes: #20694, #20456
Diffstat (limited to 'Tests/RunCMake/PrecompileHeaders')
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchInterface.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
index a1e0792..aab20d8 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchInterface.cmake
@@ -9,6 +9,9 @@ target_precompile_headers(foo PUBLIC
<stdio.h>
\"string.h\"
)
+if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+ set_property(SOURCE foo.c APPEND PROPERTY COMPILE_OPTIONS "-WX-")
+endif()
add_library(bar INTERFACE)
target_include_directories(bar INTERFACE include)