diff options
author | Brad King <brad.king@kitware.com> | 2021-02-22 15:40:23 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-02-22 15:40:29 (GMT) |
commit | c6feaa502ec4cad3d20bbfaed4c26c974d706f0b (patch) | |
tree | a6dc369bd485f75e4b903e113a20519dadb065dc /Tests | |
parent | c8c51c9534918a2926ccbf6207a3496fc5eb15df (diff) | |
parent | 9945b3b5655a8cefc0a0fb43bdb1948b6ab5bc32 (diff) | |
download | CMake-c6feaa502ec4cad3d20bbfaed4c26c974d706f0b.zip CMake-c6feaa502ec4cad3d20bbfaed4c26c974d706f0b.tar.gz CMake-c6feaa502ec4cad3d20bbfaed4c26c974d706f0b.tar.bz2 |
Merge topic 'vs-pch-one-lang'
9945b3b565 VS: Restore support for PCH in CXX but not C within once target
d9fd32b3b3 cmVisualStudio10TargetGenerator: Refactor per-source PCH logic
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5836
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/CXXnotC.cmake | 15 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/include/cxx_pch.h | 1 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/no_pch.c | 7 | ||||
-rw-r--r-- | Tests/RunCMake/PrecompileHeaders/use_pch.cxx | 9 |
5 files changed, 33 insertions, 0 deletions
diff --git a/Tests/RunCMake/PrecompileHeaders/CXXnotC.cmake b/Tests/RunCMake/PrecompileHeaders/CXXnotC.cmake new file mode 100644 index 0000000..9ec1b36 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/CXXnotC.cmake @@ -0,0 +1,15 @@ +enable_language(C) +enable_language(CXX) + +add_executable(main + no_pch.c + use_pch.cxx +) + +target_include_directories(main PUBLIC include) +target_precompile_headers(main PRIVATE + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/include/cxx_pch.h>" + ) + +enable_testing() +add_test(NAME main COMMAND main) diff --git a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake index a5a3770..8cc59d2 100644 --- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake +++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake @@ -14,6 +14,7 @@ run_cmake(PchDebugGenex) run_test(PchInterface) run_cmake(PchPrologueEpilogue) run_test(SkipPrecompileHeaders) +run_test(CXXnotC) run_test(PchReuseFrom) run_test(PchReuseFromPrefixed) run_test(PchReuseFromSubdir) diff --git a/Tests/RunCMake/PrecompileHeaders/include/cxx_pch.h b/Tests/RunCMake/PrecompileHeaders/include/cxx_pch.h new file mode 100644 index 0000000..3282cec --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/include/cxx_pch.h @@ -0,0 +1 @@ +#define CXX_PCH diff --git a/Tests/RunCMake/PrecompileHeaders/no_pch.c b/Tests/RunCMake/PrecompileHeaders/no_pch.c new file mode 100644 index 0000000..8d22580 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/no_pch.c @@ -0,0 +1,7 @@ +#ifdef CXX_PCH +# error "CXX PCH included in C source." +#endif +int no_pch(void) +{ + return 0; +} diff --git a/Tests/RunCMake/PrecompileHeaders/use_pch.cxx b/Tests/RunCMake/PrecompileHeaders/use_pch.cxx new file mode 100644 index 0000000..caf115b --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/use_pch.cxx @@ -0,0 +1,9 @@ +#include "cxx_pch.h" +#ifndef CXX_PCH +# error "CXX PCH not included in CXX source." +#endif +extern "C" int no_pch(void); +int main() +{ + return no_pch(); +} |