diff options
author | Brad King <brad.king@kitware.com> | 2019-10-16 17:23:23 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-10-17 14:29:31 (GMT) |
commit | 797689ab35c6f1edc37b120804e348b03ce7b161 (patch) | |
tree | 45f9980d83280112e450ec768efd9d589933451b /Tests/BuildDepends/Project | |
parent | 0b10b3ed6b3ee644a44414d8b5c205d94a967c12 (diff) | |
download | CMake-797689ab35c6f1edc37b120804e348b03ce7b161.zip CMake-797689ab35c6f1edc37b120804e348b03ce7b161.tar.gz CMake-797689ab35c6f1edc37b120804e348b03ce7b161.tar.bz2 |
PCH: Fix Makefile dependencies to rebuild PCH on header changes
Teach the Makefile generator to scan the implicit dependencies of PCH
creation. When a header named by `target_precompile_headers` changes
the corresponding PCH must be rebuilt and all consumers recompiled.
Fixes: #19830
Diffstat (limited to 'Tests/BuildDepends/Project')
-rw-r--r-- | Tests/BuildDepends/Project/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/BuildDepends/Project/zot.cxx | 5 | ||||
-rw-r--r-- | Tests/BuildDepends/Project/zot_pch.cxx | 6 |
3 files changed, 15 insertions, 2 deletions
diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 3f41b26..8338800 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -93,6 +93,12 @@ add_executable(zot zot.cxx ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx zot_macro_dir.cxx zot_macro_tgt.cxx) add_dependencies(zot zot_custom) +add_library(zot_pch zot_pch.cxx) +target_link_libraries(zot zot_pch) +if(NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]") + target_precompile_headers(zot_pch PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/zot_pch.hxx) +endif() + # Test the #include line macro transformation rule support. set_property( TARGET zot diff --git a/Tests/BuildDepends/Project/zot.cxx b/Tests/BuildDepends/Project/zot.cxx index faee7d3..2d08c4b 100644 --- a/Tests/BuildDepends/Project/zot.cxx +++ b/Tests/BuildDepends/Project/zot.cxx @@ -4,11 +4,12 @@ const char* zot_macro_dir_f(); const char* zot_macro_tgt_f(); +const char* zot_pch_f(); int main() { - printf("[%s] [%s] [%s] [%s]\n", zot, zot_custom, zot_macro_dir_f(), - zot_macro_tgt_f()); + printf("[%s] [%s] [%s] [%s] [%s]\n", zot, zot_custom, zot_macro_dir_f(), + zot_macro_tgt_f(), zot_pch_f()); fflush(stdout); return 0; } diff --git a/Tests/BuildDepends/Project/zot_pch.cxx b/Tests/BuildDepends/Project/zot_pch.cxx new file mode 100644 index 0000000..d9d04c7 --- /dev/null +++ b/Tests/BuildDepends/Project/zot_pch.cxx @@ -0,0 +1,6 @@ +#include <zot_pch.hxx> + +const char* zot_pch_f() +{ + return zot_pch; +} |