summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmLocalGenerator.cxx47
2 files changed, 34 insertions, 15 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index a88f95a..7f74e3b 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,7 +2,7 @@
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 16)
set(CMake_VERSION_PATCH 0)
-set(CMake_VERSION_RC 4)
+#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
# Start with the full version number used in tags. It has no dev info.
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 8d7b350..1754421 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2382,9 +2382,25 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
target->GetLocalGenerator()->GetCurrentBinaryDirectory(), "/",
target->GetName(), ".dir/${PDB_PREFIX}");
- file << "if (EXISTS \"" << from_file << "\")\n";
+ const std::string to_file =
+ cmStrCat(to_dir, pchReuseFrom, extension);
+
+ std::string dest_file = to_file;
+
+ const std::string prefix = target->GetSafeProperty("PREFIX");
+ if (!prefix.empty()) {
+ dest_file = cmStrCat(to_dir, prefix, pchReuseFrom, extension);
+ }
+
+ file << "if (EXISTS \"" << from_file << "\" AND \"" << from_file
+ << "\" IS_NEWER_THAN \"" << dest_file << "\")\n";
file << " file(COPY \"" << from_file << "\""
<< " DESTINATION \"" << to_dir << "\")\n";
+ if (!prefix.empty()) {
+ file << " file(REMOVE \"" << dest_file << "\")\n";
+ file << " file(RENAME \"" << to_file << "\" \"" << dest_file
+ << "\")\n";
+ }
file << "endif()\n";
}
@@ -3145,6 +3161,22 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
}
}
+ // Ensure that for the CMakeFiles/<target>.dir/generated_source_file
+ // we don't end up having:
+ // CMakeFiles/<target>.dir/CMakeFiles/<target>.dir/generated_source_file.obj
+ const char* unitySourceFile = source.GetProperty("UNITY_SOURCE_FILE");
+ const char* pchExtension = source.GetProperty("PCH_EXTENSION");
+ if (unitySourceFile || pchExtension) {
+ if (pchExtension) {
+ customOutputExtension = pchExtension;
+ }
+
+ cmsys::RegularExpression var("(CMakeFiles/[^/]+.dir/)");
+ if (var.find(objectName)) {
+ objectName.erase(var.start(), var.end() - var.start());
+ }
+ }
+
// Replace the original source file extension with the object file
// extension.
bool keptSourceExtension = true;
@@ -3161,19 +3193,6 @@ std::string cmLocalGenerator::GetObjectFileNameWithoutTarget(
}
}
- const char* pchExtension = source.GetProperty("PCH_EXTENSION");
- if (pchExtension) {
- customOutputExtension = pchExtension;
-
- // Make sure that for the CMakeFiles/<target>.dir/cmake_pch.h|xx.c|xx
- // source file, we don't end up having
- // CMakeFiles/<target>.dir/CMakeFiles/<target>.dir/cmake_pch.h|xx.pch
- cmsys::RegularExpression var("(CMakeFiles/[^/]+.dir/)");
- while (var.find(objectName)) {
- objectName.erase(var.start(), var.end() - var.start());
- }
- }
-
// Remove the source extension if it is to be replaced.
if (replaceExt || customOutputExtension) {
keptSourceExtension = false;