diff options
author | Brad King <brad.king@kitware.com> | 2021-09-14 13:47:45 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-09-14 13:48:00 (GMT) |
commit | 69c0a5daf98958ba6ad4311781ec72fe8b9bfb0a (patch) | |
tree | df52b3e1a2631b70f0d602a4348414d3a607e9bf /Tests | |
parent | 8f67d42671942aebfe345a574c563f59efe931d0 (diff) | |
parent | bbcdac4e5d53de12013c6af6395b28e4816f7823 (diff) | |
download | CMake-69c0a5daf98958ba6ad4311781ec72fe8b9bfb0a.zip CMake-69c0a5daf98958ba6ad4311781ec72fe8b9bfb0a.tar.gz CMake-69c0a5daf98958ba6ad4311781ec72fe8b9bfb0a.tar.bz2 |
Merge topic 'pch-xcode-multiple-languages'
bbcdac4e5d PCH: Fix all-language precompile header support in Xcode
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6435
Diffstat (limited to 'Tests')
5 files changed, 35 insertions, 0 deletions
diff --git a/Tests/RunCMake/PrecompileHeaders/PchIncludedAllLanguages.cmake b/Tests/RunCMake/PrecompileHeaders/PchIncludedAllLanguages.cmake new file mode 100644 index 0000000..a455410 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/PchIncludedAllLanguages.cmake @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.15) +project(PchIncludedAllLanguages C CXX) + +if(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH) + add_definitions(-DHAVE_PCH_SUPPORT) +endif() + +add_executable(main + main.cpp + pch-included.c + pch-included.cpp +) +target_precompile_headers(main PRIVATE 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 8cc59d2..e723e03 100644 --- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake +++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake @@ -28,3 +28,4 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja") endif() endif() run_test(PchReuseFromObjLib) +run_test(PchIncludedAllLanguages) diff --git a/Tests/RunCMake/PrecompileHeaders/pch-included.c b/Tests/RunCMake/PrecompileHeaders/pch-included.c new file mode 100644 index 0000000..96fce69 --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/pch-included.c @@ -0,0 +1,8 @@ +#ifndef HAVE_PCH_SUPPORT +# include "pch.h" +#endif + +int testC(void) +{ + return PCH_INCLUDED; +} diff --git a/Tests/RunCMake/PrecompileHeaders/pch-included.cpp b/Tests/RunCMake/PrecompileHeaders/pch-included.cpp new file mode 100644 index 0000000..bf4d95d --- /dev/null +++ b/Tests/RunCMake/PrecompileHeaders/pch-included.cpp @@ -0,0 +1,8 @@ +#ifndef HAVE_PCH_SUPPORT +# include "pch.h" +#endif + +int testCpp() +{ + return PCH_INCLUDED; +} diff --git a/Tests/RunCMake/PrecompileHeaders/pch.h b/Tests/RunCMake/PrecompileHeaders/pch.h index 81b6d9e..20672d1 100644 --- a/Tests/RunCMake/PrecompileHeaders/pch.h +++ b/Tests/RunCMake/PrecompileHeaders/pch.h @@ -1,3 +1,5 @@ #pragma once #define PCH_INCLUDED 1 + +int testC(void); |