summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:19:53 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-08 09:19:53 +0900
commit2b122af3955c974531d52d21bf1031edc5ea4970 (patch)
tree71da1fb127f0f7f64f75e08d4f98cfa6be5bf6a5
parent8b67c673914c98a96faeb99585662a5d12ae54df (diff)
downloadcmake-2b122af3955c974531d52d21bf1031edc5ea4970.tar.gz
cmake-2b122af3955c974531d52d21bf1031edc5ea4970.tar.bz2
cmake-2b122af3955c974531d52d21bf1031edc5ea4970.zip
Imported Upstream version 3.16.8upstream/3.16.8
-rw-r--r--Source/CMakeVersion.cmake4
-rw-r--r--Source/cmGeneratorTarget.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx18
-rw-r--r--Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake7
4 files changed, 24 insertions, 7 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 53691e3de..2ee7e8013 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 16)
-set(CMake_VERSION_PATCH 7)
+set(CMake_VERSION_PATCH 8)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
@@ -21,7 +21,7 @@ endif()
if(NOT CMake_VERSION_NO_GIT)
# If this source was exported by 'git archive', use its commit info.
- set(git_info [==[e14974a208 CMake 3.16.7]==])
+ set(git_info [==[39c6ac5112 CMake 3.16.8]==])
# Otherwise, try to identify the current development source version.
if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index cde91c90c..4cf076eb9 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3496,8 +3496,6 @@ std::string cmGeneratorTarget::GetPchFileObject(const std::string& config,
}
std::string& filename = inserted.first->second;
- this->AddSource(pchSource, true);
-
auto pchSf = this->Makefile->GetOrCreateSource(
pchSource, false, cmSourceFileLocationKind::Known);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 09fb87dd7..74bcf7bbc 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1564,7 +1564,23 @@ bool cmGlobalGenerator::AddAutomaticSources()
continue;
}
lg->AddUnityBuild(gt);
- lg->AddPchDependencies(gt);
+ // Targets that re-use a PCH are handled below.
+ if (!gt->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) {
+ lg->AddPchDependencies(gt);
+ }
+ }
+ }
+ for (cmLocalGenerator* lg : this->LocalGenerators) {
+ for (cmGeneratorTarget* gt : lg->GetGeneratorTargets()) {
+ if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
+ gt->GetType() == cmStateEnums::UTILITY ||
+ gt->GetType() == cmStateEnums::GLOBAL_TARGET) {
+ continue;
+ }
+ // Handle targets that re-use a PCH from an above-handled target.
+ if (gt->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) {
+ lg->AddPchDependencies(gt);
+ }
}
}
// The above transformations may have changed the classification of sources.
diff --git a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
index 03a97eda4..f8fba441a 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchReuseFrom.cmake
@@ -5,6 +5,11 @@ if(CMAKE_C_COMPILE_OPTIONS_USE_PCH)
add_definitions(-DHAVE_PCH_SUPPORT)
endif()
+# Add this before the target from which we will reuse the PCH
+# to test that generators can handle reversed ordering.
+add_library(foo foo.c)
+target_include_directories(foo PUBLIC include)
+
add_library(empty empty.c)
target_precompile_headers(empty PRIVATE
<stdio.h>
@@ -12,8 +17,6 @@ target_precompile_headers(empty PRIVATE
)
target_include_directories(empty PUBLIC include)
-add_library(foo foo.c)
-target_include_directories(foo PUBLIC include)
target_precompile_headers(foo REUSE_FROM empty)
# should not cause problems if configured multiple times