summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst3
-rw-r--r--Help/policy/CMP0112.rst1
-rw-r--r--Help/variable/CMAKE_LANG_COMPILER_ID.rst2
-rw-r--r--Modules/CMakeCompilerIdDetection.cmake2
-rw-r--r--Modules/Compiler/IntelClang-DetermineCompiler.cmake7
-rw-r--r--Modules/Compiler/IntelDPCPP-DetermineCompiler.cmake7
-rw-r--r--Modules/FindPython/Support.cmake12
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmGeneratorTarget.cxx7
-rw-r--r--Source/cmLocalGenerator.cxx28
-rw-r--r--Source/cmNinjaTargetGenerator.cxx15
-rw-r--r--Source/cmQtAutoGenInitializer.cxx23
-rw-r--r--Source/cmTransformDepfile.cxx3
-rw-r--r--Tests/ISPC/ObjectLibrary/CMakeLists.txt2
-rw-r--r--Tests/ISPC/ObjectLibrary/subdir/extra.ispc (renamed from Tests/ISPC/ObjectLibrary/extra.ispc)0
-rw-r--r--Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake3
-rw-r--r--Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake13
19 files changed, 93 insertions, 45 deletions
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index ff9d1bf..482b14e 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -648,6 +648,9 @@ which is just the string ``tgt``.
expression is evaluated on.
``$<TARGET_FILE_NAME:tgt>``
The ``tgt`` filename.
+
+ Note that ``tgt`` is not added as a dependency of the target this
+ expression is evaluated on (see policy :policy:`CMP0112`).
``$<TARGET_FILE_DIR:tgt>``
Directory of the ``tgt`` binary file.
diff --git a/Help/policy/CMP0112.rst b/Help/policy/CMP0112.rst
index 78a9055..313a51e 100644
--- a/Help/policy/CMP0112.rst
+++ b/Help/policy/CMP0112.rst
@@ -8,6 +8,7 @@ Target file component generator expressions do not add target dependencies.
The following target-based generator expressions that query for directory or
file name components no longer add a dependency on the evaluated target.
+ - ``TARGET_FILE_NAME``
- ``TARGET_FILE_DIR``
- ``TARGET_LINKER_FILE_BASE_NAME``
- ``TARGET_LINKER_FILE_NAME``
diff --git a/Help/variable/CMAKE_LANG_COMPILER_ID.rst b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
index 99ff015..8eb4fb6 100644
--- a/Help/variable/CMAKE_LANG_COMPILER_ID.rst
+++ b/Help/variable/CMAKE_LANG_COMPILER_ID.rst
@@ -25,8 +25,6 @@ include:
HP = Hewlett-Packard Compiler (hp.com)
IAR = IAR Systems (iar.com)
Intel = Intel Compiler (intel.com)
- IntelDPCPP = Intel DPCPP Compiler (intel.com)
- IntelClang = Intel Clang Compiler (intel.com)
MSVC = Microsoft Visual Studio (microsoft.com)
NVIDIA = NVIDIA CUDA Compiler (nvidia.com)
OpenWatcom = Open Watcom (openwatcom.org)
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index 26fb381..a0f0dfa 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -78,8 +78,6 @@ function(compiler_id_detection outvar lang)
ARMCC
AppleClang
ARMClang
- IntelDPCPP
- IntelClang
Clang
GNU
MSVC
diff --git a/Modules/Compiler/IntelClang-DetermineCompiler.cmake b/Modules/Compiler/IntelClang-DetermineCompiler.cmake
deleted file mode 100644
index 3544be3..0000000
--- a/Modules/Compiler/IntelClang-DetermineCompiler.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-set(_compiler_id_pp_test "defined(__clang__) && defined(__INTEL_CLANG_COMPILER)")
-
-include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake")
-
-string(APPEND _compiler_id_version_compute "
-# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__INTEL_CLANG_COMPILER)")
diff --git a/Modules/Compiler/IntelDPCPP-DetermineCompiler.cmake b/Modules/Compiler/IntelDPCPP-DetermineCompiler.cmake
deleted file mode 100644
index 7bbb21c..0000000
--- a/Modules/Compiler/IntelDPCPP-DetermineCompiler.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-
-set(_compiler_id_pp_test "defined(__clang__) && defined(__INTEL_DPCPP_COMPILER__)")
-
-include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake")
-
-string(APPEND _compiler_id_version_compute "
-# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__INTEL_DPCPP_COMPILER__)")
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 0e76468..0c775f7 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -456,7 +456,11 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
list (REMOVE_DUPLICATES _values)
elseif (NAME STREQUAL "SOABI")
# clean-up: remove prefix character and suffix
- string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
+ if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
+ set(_values "")
+ else()
+ string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
+ endif()
endif()
endif()
endif()
@@ -508,7 +512,11 @@ function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
endforeach()
if (_values)
# clean-up: remove prefix character and suffix
- string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
+ if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
+ set(_values "")
+ else()
+ string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
+ endif()
endif()
endif()
else()
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 8eac90d..0d730eb 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 19)
-set(CMake_VERSION_PATCH 20201207)
+set(CMake_VERSION_PATCH 20201209)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 12f8e44..b444edd 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -5086,9 +5086,14 @@ void cmGeneratorTarget::GetTargetObjectNames(
objects.push_back(map_it->second);
}
+ // We need to compute the relative path from the root of
+ // of the object directory to handle subdirectory paths
+ std::string rootObjectDir = this->GetObjectDirectory(config);
+ rootObjectDir = cmSystemTools::CollapseFullPath(rootObjectDir);
auto ispcObjects = this->GetGeneratedISPCObjects(config);
for (std::string const& output : ispcObjects) {
- objects.push_back(cmSystemTools::GetFilenameName(output));
+ auto relativePathFromObjectDir = output.substr(rootObjectDir.size());
+ objects.push_back(relativePathFromObjectDir);
}
}
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d9b7926..c9dfdea 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3,6 +3,7 @@
#include "cmLocalGenerator.h"
#include <algorithm>
+#include <array>
#include <cassert>
#include <cstdio>
#include <cstdlib>
@@ -2431,9 +2432,10 @@ void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target)
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
for (std::string const& config : configsList) {
- std::string perConfigDir = target->GetObjectDirectory(config);
+ std::string rootObjectDir = target->GetObjectDirectory(config);
+ std::string headerDir = rootObjectDir;
if (cmProp prop = target->GetProperty("ISPC_HEADER_DIRECTORY")) {
- perConfigDir = cmSystemTools::CollapseFullPath(
+ headerDir = cmSystemTools::CollapseFullPath(
cmStrCat(this->GetBinaryDirectory(), '/', *prop));
}
@@ -2450,11 +2452,11 @@ void cmLocalGenerator::AddISPCDependencies(cmGeneratorTarget* target)
std::string ispcSource =
cmSystemTools::GetFilenameWithoutLastExtension(objectName);
- auto headerPath = cmStrCat(perConfigDir, '/', ispcSource, ".h");
+ auto headerPath = cmStrCat(headerDir, '/', ispcSource, ".h");
target->AddISPCGeneratedHeader(headerPath, config);
if (extra_objects) {
std::vector<std::string> objs = detail::ComputeISPCExtraObjects(
- objectName, perConfigDir, ispcSuffixes);
+ objectName, rootObjectDir, ispcSuffixes);
target->AddISPCGeneratedObject(std::move(objs), config);
}
}
@@ -2474,8 +2476,10 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
target->GetSourceFiles(sources, config);
const std::string configUpper = cmSystemTools::UpperCase(config);
+ static const std::array<std::string, 4> langs = { { "C", "CXX", "OBJC",
+ "OBJCXX" } };
- for (const std::string& lang : { "C", "CXX", "OBJC", "OBJCXX" }) {
+ for (const std::string& lang : langs) {
auto langSources = std::count_if(
sources.begin(), sources.end(), [lang](cmSourceFile* sf) {
return lang == sf->GetLanguage() &&
@@ -4098,15 +4102,23 @@ std::vector<std::string> ComputeISPCExtraObjects(
std::string const& objectName, std::string const& buildDirectory,
std::vector<std::string> const& ispcSuffixes)
{
+ auto normalizedDir = cmSystemTools::CollapseFullPath(buildDirectory);
std::vector<std::string> computedObjects;
computedObjects.reserve(ispcSuffixes.size());
auto extension = cmSystemTools::GetFilenameLastExtension(objectName);
- auto objNameNoExt =
- cmSystemTools::GetFilenameWithoutLastExtension(objectName);
+
+ // We can't use cmSystemTools::GetFilenameWithoutLastExtension as it
+ // drops any directories in objectName
+ auto objNameNoExt = objectName;
+ std::string::size_type dot_pos = objectName.rfind('.');
+ if (dot_pos != std::string::npos) {
+ objNameNoExt.resize(dot_pos);
+ }
+
for (const auto& ispcTarget : ispcSuffixes) {
computedObjects.emplace_back(
- cmStrCat(buildDirectory, "/", objNameNoExt, "_", ispcTarget, extension));
+ cmStrCat(normalizedDir, "/", objNameNoExt, "_", ispcTarget, extension));
}
return computedObjects;
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 6edbf82..838cf4c 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -1357,15 +1357,16 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
std::string ispcSource =
cmSystemTools::GetFilenameWithoutLastExtension(objectName);
- std::string ispcDirectory = objectFileDir;
+ std::string ispcHeaderDirectory =
+ this->GeneratorTarget->GetObjectDirectory(config);
if (cmProp prop =
this->GeneratorTarget->GetProperty("ISPC_HEADER_DIRECTORY")) {
- ispcDirectory = *prop;
+ ispcHeaderDirectory =
+ cmStrCat(this->LocalGenerator->GetBinaryDirectory(), '/', *prop);
}
- ispcDirectory =
- cmStrCat(this->LocalGenerator->GetBinaryDirectory(), '/', ispcDirectory);
- std::string ispcHeader = cmStrCat(ispcDirectory, '/', ispcSource, ".h");
+ std::string ispcHeader =
+ cmStrCat(ispcHeaderDirectory, '/', ispcSource, ".h");
ispcHeader = this->ConvertToNinjaPath(ispcHeader);
// Make sure ninja knows what command generates the header
@@ -1377,8 +1378,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
auto ispcSuffixes =
detail::ComputeISPCObjectSuffixes(this->GeneratorTarget);
if (ispcSuffixes.size() > 1) {
+ std::string rootObjectDir =
+ this->GeneratorTarget->GetObjectDirectory(config);
auto ispcSideEfffectObjects = detail::ComputeISPCExtraObjects(
- objectName, ispcDirectory, ispcSuffixes);
+ objectName, rootObjectDir, ispcSuffixes);
for (auto sideEffect : ispcSideEfffectObjects) {
sideEffect = this->ConvertToNinjaPath(sideEffect);
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index f27b788..67834f1 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -29,6 +29,7 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
+#include "cmGlobalNinjaGenerator.h"
#include "cmLinkItem.h"
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
@@ -1237,11 +1238,23 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
const std::string outputFile =
cmStrCat(this->Dir.Build, "/", timestampFileName);
this->AutogenTarget.DepFile = cmStrCat(this->Dir.Build, "/deps");
- auto relativeBinaryDir = cmSystemTools::RelativePath(
- this->LocalGen->GetBinaryDirectory(),
- this->LocalGen->GetCurrentBinaryDirectory());
- if (!relativeBinaryDir.empty()) {
- relativeBinaryDir = cmStrCat(relativeBinaryDir, "/");
+ std::string relativeBinaryDir;
+ if (dynamic_cast<cmGlobalNinjaGenerator*>(this->GlobalGen)) {
+ switch (this->LocalGen->GetPolicyStatus(cmPolicies::CMP0116)) {
+ case cmPolicies::OLD:
+ case cmPolicies::WARN:
+ relativeBinaryDir = cmSystemTools::RelativePath(
+ this->LocalGen->GetBinaryDirectory(),
+ this->LocalGen->GetCurrentBinaryDirectory());
+ if (!relativeBinaryDir.empty()) {
+ relativeBinaryDir = cmStrCat(relativeBinaryDir, "/");
+ }
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ break;
+ }
}
this->AutogenTarget.DepFileRuleName =
cmStrCat(relativeBinaryDir, this->GenTarget->GetName(), "_autogen/",
diff --git a/Source/cmTransformDepfile.cxx b/Source/cmTransformDepfile.cxx
index e1f8753..163d7e0 100644
--- a/Source/cmTransformDepfile.cxx
+++ b/Source/cmTransformDepfile.cxx
@@ -47,7 +47,8 @@ void WriteGccDepfile(cmsys::ofstream& fout, const cmGccDepfileContent& content)
}
fout << ':';
for (auto const& path : dep.paths) {
- fout << " \\\n " << path;
+ fout << " \\\n ";
+ WriteFilenameGcc(fout, path);
}
fout << '\n';
}
diff --git a/Tests/ISPC/ObjectLibrary/CMakeLists.txt b/Tests/ISPC/ObjectLibrary/CMakeLists.txt
index 4767d7e..a4c81a9 100644
--- a/Tests/ISPC/ObjectLibrary/CMakeLists.txt
+++ b/Tests/ISPC/ObjectLibrary/CMakeLists.txt
@@ -8,7 +8,7 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
endif()
-add_library(ispc_objects OBJECT simple.ispc extra.ispc)
+add_library(ispc_objects OBJECT simple.ispc subdir/extra.ispc)
set_target_properties(ispc_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(ispc_objects PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i8x16")
diff --git a/Tests/ISPC/ObjectLibrary/extra.ispc b/Tests/ISPC/ObjectLibrary/subdir/extra.ispc
index 5a4a442..5a4a442 100644
--- a/Tests/ISPC/ObjectLibrary/extra.ispc
+++ b/Tests/ISPC/ObjectLibrary/subdir/extra.ispc
diff --git a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake
index d69a119..d314ff3 100644
--- a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake
+++ b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake
@@ -7,3 +7,6 @@ set(CMAKE_AUTOMOC ON)
add_library(simple_lib SHARED simple_lib.cpp)
add_executable(app_with_qt app.cpp app_qt.cpp)
target_link_libraries(app_with_qt PRIVATE simple_lib Qt5::Core)
+
+add_subdirectory(QtSubDir1)
+add_subdirectory(QtSubDir2)
diff --git a/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt
new file mode 100644
index 0000000..64016b6
--- /dev/null
+++ b/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_policy(SET CMP0116 OLD)
+
+add_executable(sub_exe_1 ../app.cpp)
+target_link_libraries(sub_exe_1 PRIVATE Qt5::Core)
diff --git a/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt
new file mode 100644
index 0000000..3176426
--- /dev/null
+++ b/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_policy(SET CMP0116 NEW)
+
+add_executable(sub_exe_2 ../app.cpp)
+target_link_libraries(sub_exe_2 PRIVATE Qt5::Core)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index e6f86a1..b91ab00 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -338,8 +338,17 @@ function(run_Qt5AutoMocDeps)
# Build and assert that AUTOMOC was not run for app_with_qt.
run_ninja("${RunCMake_TEST_BINARY_DIR}")
if(ninja_stdout MATCHES "Automatic MOC for target app_with_qt")
- message(FATAL_ERROR
- "AUTOMOC should not have executed for 'app_with_qt' target:\nstdout:\n${ninja_stdout}")
+ message(FATAL_ERROR
+ "AUTOMOC should not have executed for 'app_with_qt' target:\nstdout:\n${ninja_stdout}")
+ endif()
+ # Assert that the subdir executables were not rebuilt.
+ if(ninja_stdout MATCHES "Automatic MOC for target sub_exe_1")
+ message(FATAL_ERROR
+ "AUTOMOC should not have executed for 'sub_exe_1' target:\nstdout:\n${ninja_stdout}")
+ endif()
+ if(ninja_stdout MATCHES "Automatic MOC for target sub_exe_2")
+ message(FATAL_ERROR
+ "AUTOMOC should not have executed for 'sub_exe_2' target:\nstdout:\n${ninja_stdout}")
endif()
endif()
endfunction()