summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-policies.7.rst1
-rw-r--r--Help/policy/CMP0108.rst19
-rw-r--r--Help/prop_tgt/C_STANDARD.rst4
-rw-r--r--Help/release/dev/self-link-through-alias.rst5
-rw-r--r--Modules/Platform/Darwin.cmake26
-rw-r--r--Modules/UseSWIG.cmake8
-rw-r--r--Source/CPack/cmCPackGenerator.cxx7
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx1
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx1
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx1
-rw-r--r--Source/cmCTest.cxx1
-rw-r--r--Source/cmCacheManager.h1
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx1
-rw-r--r--Source/cmCommonTargetGenerator.cxx1
-rw-r--r--Source/cmComputeLinkInformation.cxx34
-rw-r--r--Source/cmCustomCommandGenerator.cxx1
-rw-r--r--Source/cmDependsC.cxx4
-rw-r--r--Source/cmDependsFortran.cxx10
-rw-r--r--Source/cmExportFileGenerator.cxx1
-rw-r--r--Source/cmExportLibraryDependenciesCommand.cxx3
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx1
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx1
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx3
-rw-r--r--Source/cmFileAPICache.cxx1
-rw-r--r--Source/cmFileAPICodemodel.cxx1
-rw-r--r--Source/cmFindBase.cxx1
-rw-r--r--Source/cmFindCommon.cxx8
-rw-r--r--Source/cmFindPackageCommand.cxx5
-rw-r--r--Source/cmForEachCommand.cxx8
-rw-r--r--Source/cmGeneratorExpressionNode.cxx1
-rw-r--r--Source/cmGeneratorTarget.cxx70
-rw-r--r--Source/cmGeneratorTarget.h2
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx1
-rw-r--r--Source/cmGetDirectoryPropertyCommand.cxx1
-rw-r--r--Source/cmGetTargetPropertyCommand.cxx1
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx1
-rw-r--r--Source/cmGlobalCommonGenerator.cxx1
-rw-r--r--Source/cmGlobalGenerator.cxx6
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx1
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx1
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
-rw-r--r--Source/cmInstallCommand.cxx1
-rw-r--r--Source/cmInstallTargetGenerator.cxx3
-rw-r--r--Source/cmJsonObjects.cxx1
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx1
-rw-r--r--Source/cmLocalGenerator.cxx10
-rw-r--r--Source/cmLocalNinjaGenerator.cxx1
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx1
-rw-r--r--Source/cmMakefile.cxx17
-rw-r--r--Source/cmMakefile.h5
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx12
-rw-r--r--Source/cmMakefileTargetGenerator.cxx1
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx20
-rw-r--r--Source/cmNinjaTargetGenerator.cxx7
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx1
-rw-r--r--Source/cmOptionCommand.cxx1
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx3
-rw-r--r--Source/cmPolicies.h5
-rw-r--r--Source/cmProperty.h4
-rw-r--r--Source/cmPropertyMap.h2
-rw-r--r--Source/cmQTWrapCPPCommand.cxx1
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx1
-rw-r--r--Source/cmQtAutoGenInitializer.cxx6
-rw-r--r--Source/cmServerProtocol.cxx3
-rw-r--r--Source/cmSetCommand.cxx1
-rw-r--r--Source/cmSourceFile.h3
-rw-r--r--Source/cmState.cxx2
-rw-r--r--Source/cmState.h2
-rw-r--r--Source/cmStateDirectory.h3
-rw-r--r--Source/cmStateSnapshot.cxx1
-rw-r--r--Source/cmTarget.h3
-rw-r--r--Source/cmTargetPropCommandBase.cxx3
-rw-r--r--Source/cmTargetPropertyComputer.h3
-rw-r--r--Source/cmTestGenerator.cxx1
-rw-r--r--Source/cmTryRunCommand.cxx1
-rw-r--r--Source/cmUtilitySourceCommand.cxx4
-rw-r--r--Source/cmake.cxx11
-rw-r--r--Source/cmake.h1
-rw-r--r--Source/cmakemain.cxx1
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-stderr.txt5
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link.cmake4
-rw-r--r--Tests/RunCMake/target_link_libraries/CMP0108-self-link.cmake9
-rw-r--r--Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake2
87 files changed, 239 insertions, 188 deletions
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 8d41ed8..e98038a 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.18
.. toctree::
:maxdepth: 1
+ CMP0108: A target cannot link to itself through an alias. </policy/CMP0108>
CMP0107: An ALIAS target cannot overwrite another target. </policy/CMP0107>
CMP0106: The Documentation module is removed. </policy/CMP0106>
CMP0105: Device link step uses the link options. </policy/CMP0105>
diff --git a/Help/policy/CMP0108.rst b/Help/policy/CMP0108.rst
new file mode 100644
index 0000000..0d54cfa
--- /dev/null
+++ b/Help/policy/CMP0108.rst
@@ -0,0 +1,19 @@
+CMP0108
+-------
+
+A target is not allowed to link to itself even through an ``ALIAS`` target.
+
+In CMake 3.17 and below, a target can link to a target aliased to itself.
+
+The ``OLD`` behavior for this policy is to allow a target to link to a target
+aliased to itself.
+
+The ``NEW`` behavior of this policy is to prevent a target to link to itself
+through an ``ALIAS`` target.
+
+This policy was introduced in CMake version 3.17. Use the
+:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
+Unlike many policies, CMake version |release| does *not* warn
+when this policy is not set and simply uses ``OLD`` behavior.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_tgt/C_STANDARD.rst b/Help/prop_tgt/C_STANDARD.rst
index e7f7904..6a05139 100644
--- a/Help/prop_tgt/C_STANDARD.rst
+++ b/Help/prop_tgt/C_STANDARD.rst
@@ -6,8 +6,8 @@ The C standard whose features are requested to build this target.
This property specifies the C standard whose features are requested
to build this target. For some compilers, this results in adding a
flag such as ``-std=gnu11`` to the compile line. For compilers that
-have no notion of a standard level, such as Microsoft Visual C++ before
-2015 Update 3, this has no effect.
+have no notion of a C standard level, such as all versions of
+MSVC known as of this version of CMake, this has no effect.
Supported values are ``90``, ``99`` and ``11``.
diff --git a/Help/release/dev/self-link-through-alias.rst b/Help/release/dev/self-link-through-alias.rst
new file mode 100644
index 0000000..d91d7ae
--- /dev/null
+++ b/Help/release/dev/self-link-through-alias.rst
@@ -0,0 +1,5 @@
+self-link-through-alias
+-----------------------
+
+* Linking a target to itself through an alias now raise an error.
+ See policy :policy:`CMP0108`.
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 0a4d4e1..c6de3b0 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -42,6 +42,7 @@ endif()
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
+set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".tbd" ".so")
set(CMAKE_SHARED_MODULE_PREFIX "lib")
set(CMAKE_SHARED_MODULE_SUFFIX ".so")
set(CMAKE_MODULE_EXISTS 1)
@@ -156,6 +157,13 @@ if(_CMAKE_OSX_SYSROOT_PATH)
break()
endif()
endforeach()
+
+ if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/lib)
+ list(INSERT CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr/lib)
+ endif()
+ if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/local/lib)
+ list(INSERT CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr/local/lib)
+ endif()
endif()
if (OSX_DEVELOPER_ROOT AND EXISTS "${OSX_DEVELOPER_ROOT}/Library/Frameworks")
list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH
@@ -208,11 +216,19 @@ set(CMAKE_SYSTEM_APPBUNDLE_PATH
unset(_apps_paths)
include(Platform/UnixPaths)
-if(_CMAKE_OSX_SYSROOT_PATH AND EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${_CMAKE_OSX_SYSROOT_PATH}/usr)
- foreach(lang C CXX OBJC OBJCXX Swift)
- list(APPEND _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
- endforeach()
+if(_CMAKE_OSX_SYSROOT_PATH)
+ if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
+ list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr)
+ foreach(lang C CXX OBJC OBJCXX Swift)
+ list(APPEND _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
+ endforeach()
+ endif()
+ if(EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/local/include)
+ list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 ${_CMAKE_OSX_SYSROOT_PATH}/usr/local)
+ foreach(lang C CXX OBJC OBJCXX Swift)
+ list(APPEND _CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES_INIT ${_CMAKE_OSX_SYSROOT_PATH}/usr/local/include)
+ endforeach()
+ endif()
endif()
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
/sw # Fink
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index f6a20f8..a60e05e 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -41,6 +41,14 @@ Defines the following command for use with ``SWIG``:
configuration-specific files generated by ``SWIG``. All build
configurations must result in the same generated source file.
+ .. note::
+
+ For Make-based generators, ``swig_add_library`` does not track file
+ dependencies, so depending on the ``<name>_swig_compilation`` custom target
+ is required for targets which require the ``swig``-generated files to
+ exist. Other generators may depend on the source files that would be
+ generated by SWIG.
+
``TYPE``
``SHARED``, ``MODULE`` and ``STATIC`` have the same semantic as for the
:command:`add_library` command. If ``USE_BUILD_SHARED_LIBS`` is specified,
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 08fd2a2..288dc58 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -921,11 +921,11 @@ int cmCPackGenerator::InstallCMakeProject(
}
}
- if (nullptr != mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
+ if (auto d = mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) {
if (!absoluteDestFiles.empty()) {
absoluteDestFiles += ";";
}
- absoluteDestFiles += mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
+ absoluteDestFiles += d;
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Got some ABSOLUTE DESTINATION FILES: " << absoluteDestFiles
<< std::endl);
@@ -936,8 +936,7 @@ int cmCPackGenerator::InstallCMakeProject(
GetComponentInstallDirNameSuffix(component);
if (nullptr != this->GetOption(absoluteDestFileComponent)) {
std::string absoluteDestFilesListComponent =
- cmStrCat(this->GetOption(absoluteDestFileComponent), ';',
- mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"));
+ cmStrCat(this->GetOption(absoluteDestFileComponent), ';', d);
this->SetOption(absoluteDestFileComponent,
absoluteDestFilesListComponent.c_str());
} else {
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 2989025..ea36df5 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -21,6 +21,7 @@
#include "cmCurl.h"
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index 9250fbc..35f09fd 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -15,6 +15,7 @@
#include "cmCursesPathWidget.h"
#include "cmCursesStringWidget.h"
#include "cmCursesWidget.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index ce1a715..6fc556c 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -17,6 +17,7 @@
#include "cmCursesStandardIncludes.h"
#include "cmCursesStringWidget.h"
#include "cmCursesWidget.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 9b023d9..bca7540 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -54,6 +54,7 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmProcessOutput.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index 3d946b4..f036258 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -12,6 +12,7 @@
#include <utility>
#include <vector>
+#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmStateTypes.h"
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index 0516d26..87eb91c 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -11,6 +11,7 @@
#include "cmCommandArgumentLexer.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 32a33ee..051eff6 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -14,6 +14,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 8723d08..4c5f57d 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -21,6 +21,7 @@
#include "cmOrderDirectories.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
@@ -1330,18 +1331,13 @@ void cmComputeLinkInformation::ComputeFrameworkInfo()
std::vector<std::string> implicitDirVec;
// Get platform-wide implicit directories.
- if (const char* implicitLinks = this->Makefile->GetDefinition(
- "CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES")) {
- cmExpandList(implicitLinks, implicitDirVec);
- }
+ this->Makefile->GetDefExpandList(
+ "CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES", implicitDirVec);
// Get language-specific implicit directories.
std::string implicitDirVar = cmStrCat(
"CMAKE_", this->LinkLanguage, "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES");
- if (const char* implicitDirs =
- this->Makefile->GetDefinition(implicitDirVar)) {
- cmExpandList(implicitDirs, implicitDirVec);
- }
+ this->Makefile->GetDefExpandList(implicitDirVar, implicitDirVec);
this->FrameworkPathsEmmitted.insert(implicitDirVec.begin(),
implicitDirVec.end());
@@ -1554,10 +1550,8 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
std::vector<std::string> implicitDirVec;
// Get platform-wide implicit directories.
- if (const char* implicitLinks = (this->Makefile->GetDefinition(
- "CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES"))) {
- cmExpandList(implicitLinks, implicitDirVec);
- }
+ this->Makefile->GetDefExpandList("CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES",
+ implicitDirVec);
// Append library architecture to all implicit platform directories
// and add them to the set
@@ -1571,10 +1565,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
// Get language-specific implicit directories.
std::string implicitDirVar =
cmStrCat("CMAKE_", this->LinkLanguage, "_IMPLICIT_LINK_DIRECTORIES");
- if (const char* implicitDirs =
- this->Makefile->GetDefinition(implicitDirVar)) {
- cmExpandList(implicitDirs, implicitDirVec);
- }
+ this->Makefile->GetDefExpandList(implicitDirVar, implicitDirVec);
// Store implicit link directories.
this->ImplicitLinkDirs.insert(implicitDirVec.begin(), implicitDirVec.end());
@@ -1583,10 +1574,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
std::vector<std::string> implicitLibVec;
std::string implicitLibVar =
cmStrCat("CMAKE_", this->LinkLanguage, "_IMPLICIT_LINK_LIBRARIES");
- if (const char* implicitLibs =
- this->Makefile->GetDefinition(implicitLibVar)) {
- cmExpandList(implicitLibs, implicitLibVec);
- }
+ this->Makefile->GetDefExpandList(implicitLibVar, implicitLibVec);
// Store implicit link libraries.
for (std::string const& item : implicitLibVec) {
@@ -1598,10 +1586,8 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
}
// Get platform specific rpath link directories
- if (const char* rpathDirs =
- (this->Makefile->GetDefinition("CMAKE_PLATFORM_RUNTIME_PATH"))) {
- cmExpandList(rpathDirs, this->RuntimeLinkDirs);
- }
+ this->Makefile->GetDefExpandList("CMAKE_PLATFORM_RUNTIME_PATH",
+ this->RuntimeLinkDirs);
}
std::vector<std::string> const&
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 0fe19b6..60504ba 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -14,6 +14,7 @@
#include "cmGeneratorTarget.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 4499a66..e05c964 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -384,9 +384,7 @@ void cmDependsC::SetupTransforms()
// Get the transformation rules.
std::vector<std::string> transformRules;
cmMakefile* mf = this->LocalGenerator->GetMakefile();
- if (const char* xform = mf->GetDefinition("CMAKE_INCLUDE_TRANSFORMS")) {
- cmExpandList(xform, transformRules, true);
- }
+ mf->GetDefExpandList("CMAKE_INCLUDE_TRANSFORMS", transformRules, true);
for (std::string const& tr : transformRules) {
this->ParseTransform(tr);
}
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 95dfc4e..8f02d95 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -80,10 +80,7 @@ cmDependsFortran::cmDependsFortran(cmLocalUnixMakefileGenerator3* lg)
// Get the list of definitions.
std::vector<std::string> definitions;
cmMakefile* mf = this->LocalGenerator->GetMakefile();
- if (const char* c_defines =
- mf->GetDefinition("CMAKE_TARGET_DEFINITIONS_Fortran")) {
- cmExpandList(c_defines, definitions);
- }
+ mf->GetDefExpandList("CMAKE_TARGET_DEFINITIONS_Fortran", definitions);
// translate i.e. FOO=BAR to FOO and add it to the list of defined
// preprocessor symbols
@@ -243,10 +240,7 @@ void cmDependsFortran::LocateModules()
// Load information about other targets.
cmMakefile* mf = this->LocalGenerator->GetMakefile();
std::vector<std::string> infoFiles;
- if (const char* infoFilesValue =
- mf->GetDefinition("CMAKE_TARGET_LINKED_INFO_FILES")) {
- cmExpandList(infoFilesValue, infoFiles);
- }
+ mf->GetDefExpandList("CMAKE_TARGET_LINKED_INFO_FILES", infoFiles);
for (std::string const& i : infoFiles) {
std::string targetDir = cmSystemTools::GetFilenamePath(i);
std::string fname = targetDir + "/fortran.internal";
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index ed0689a..4d0e099 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -21,6 +21,7 @@
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx
index be63278..7f31dd2 100644
--- a/Source/cmExportLibraryDependenciesCommand.cxx
+++ b/Source/cmExportLibraryDependenciesCommand.cxx
@@ -14,6 +14,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -23,8 +24,6 @@
class cmListFileBacktrace;
-using cmProp = const std::string*;
-
static void FinalAction(cmMakefile& makefile, std::string const& filename,
bool append)
{
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 46056c1..c6b6184 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -12,6 +12,7 @@
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmTarget.h"
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 582a9f0..7bc4536 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -19,6 +19,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmSourceFile.h"
#include "cmSourceGroup.h"
#include "cmState.h"
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 253834f..613a943 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -17,14 +17,13 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmake.h"
-using cmProp = const std::string*; // just to silence IWYU
-
/*
Sublime Text 2 Generator
Author: Morné Chamberlain
diff --git a/Source/cmFileAPICache.cxx b/Source/cmFileAPICache.cxx
index 25e5916..3ba943a 100644
--- a/Source/cmFileAPICache.cxx
+++ b/Source/cmFileAPICache.cxx
@@ -10,6 +10,7 @@
#include <cm3p/json/value.h>
#include "cmFileAPI.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmake.h"
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index b7daebe..fe331ec 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -31,6 +31,7 @@
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmSourceFile.h"
#include "cmSourceGroup.h"
#include "cmState.h"
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index b5553b8..743ac75 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -10,6 +10,7 @@
#include <cmext/algorithm>
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmSearchPath.h"
#include "cmState.h"
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 82acfed..3e97150 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -4,7 +4,6 @@
#include <algorithm>
#include <array>
-#include <cstring>
#include <utility>
#include <cmext/algorithm>
@@ -280,12 +279,7 @@ void cmFindCommon::GetIgnoredPaths(std::vector<std::string>& ignore)
// Construct the list of path roots with no trailing slashes.
for (const char** pathName = paths; *pathName; ++pathName) {
// Get the list of paths to ignore from the variable.
- const char* ignorePath = this->Makefile->GetDefinition(*pathName);
- if ((ignorePath == nullptr) || (strlen(ignorePath) == 0)) {
- continue;
- }
-
- cmExpandList(ignorePath, ignore);
+ this->Makefile->GetDefExpandList(*pathName, ignore);
}
for (std::string& i : ignore) {
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index d1517fe..8d5b177 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -24,6 +24,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmSearchPath.h"
#include "cmState.h"
@@ -504,9 +505,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
case cmPolicies::NEW: {
// NEW behavior is to honor the <pkg>_ROOT variables.
std::string const rootVar = this->Name + "_ROOT";
- if (const char* pkgRoot = this->Makefile->GetDefinition(rootVar)) {
- cmExpandList(pkgRoot, rootPaths, false);
- }
+ this->Makefile->GetDefExpandList(rootVar, rootPaths, false);
cmSystemTools::GetPath(rootPaths, rootVar.c_str());
} break;
}
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 32e7892..3b82e0a 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -113,8 +113,8 @@ bool cmForEachFunctionBlocker::ReplayItems(
// At end of for each execute recorded commands
// store the old value
std::string oldDef;
- if (mf.GetDefinition(this->Args.front())) {
- oldDef = mf.GetDefinition(this->Args.front());
+ if (auto d = mf.GetDefinition(this->Args.front())) {
+ oldDef = d;
}
auto restore = false;
@@ -186,8 +186,8 @@ bool cmForEachFunctionBlocker::ReplayZipLists(
// Store old values for iteration variables
std::map<std::string, std::string> oldDefs;
for (auto i = 0u; i < values.size(); ++i) {
- if (mf.GetDefinition(iterationVars[i])) {
- oldDefs.emplace(iterationVars[i], mf.GetDefinition(iterationVars[i]));
+ if (auto d = mf.GetDefinition(iterationVars[i])) {
+ oldDefs.emplace(iterationVars[i], d);
}
}
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index e3de2d8..906df2b 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -35,6 +35,7 @@
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 39224d1..250910a 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1486,11 +1486,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
}
std::vector<std::string> debugProperties;
- const char* debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp) {
- cmExpandList(debugProp, debugProperties);
- }
+ this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES",
+ debugProperties);
bool debugSources =
!this->DebugSourcesDone && cm::contains(debugProperties, "SOURCES");
@@ -3306,11 +3303,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
nullptr, nullptr);
std::vector<std::string> debugProperties;
- const char* debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp) {
- cmExpandList(debugProp, debugProperties);
- }
+ this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES",
+ debugProperties);
bool debugIncludes = !this->DebugIncludesDone &&
cm::contains(debugProperties, "INCLUDE_DIRECTORIES");
@@ -3493,11 +3487,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
nullptr);
std::vector<std::string> debugProperties;
- const char* debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp) {
- cmExpandList(debugProp, debugProperties);
- }
+ this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES",
+ debugProperties);
bool debugOptions = !this->DebugCompileOptionsDone &&
cm::contains(debugProperties, "COMPILE_OPTIONS");
@@ -3538,11 +3529,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
nullptr);
std::vector<std::string> debugProperties;
- const char* debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp) {
- cmExpandList(debugProp, debugProperties);
- }
+ this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES",
+ debugProperties);
bool debugFeatures = !this->DebugCompileFeaturesDone &&
cm::contains(debugProperties, "COMPILE_FEATURES");
@@ -3585,11 +3573,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
nullptr, nullptr);
std::vector<std::string> debugProperties;
- const char* debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp) {
- cmExpandList(debugProp, debugProperties);
- }
+ this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES",
+ debugProperties);
bool debugDefines = !this->DebugCompileDefinitionsDone &&
cm::contains(debugProperties, "COMPILE_DEFINITIONS");
@@ -3645,11 +3630,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
nullptr, nullptr);
std::vector<std::string> debugProperties;
- const char* debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp) {
- cmExpandList(debugProp, debugProperties);
- }
+ this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES",
+ debugProperties);
bool debugDefines = !this->DebugPrecompileHeadersDone &&
std::find(debugProperties.begin(), debugProperties.end(),
@@ -4024,11 +4006,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
nullptr);
std::vector<std::string> debugProperties;
- const char* debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp) {
- cmExpandList(debugProp, debugProperties);
- }
+ this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES",
+ debugProperties);
bool debugOptions = !this->DebugLinkOptionsDone &&
cm::contains(debugProperties, "LINK_OPTIONS");
@@ -4286,11 +4265,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
nullptr);
std::vector<std::string> debugProperties;
- const char* debugProp =
- this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp) {
- cmExpandList(debugProp, debugProperties);
- }
+ this->Makefile->GetDefExpandList("CMAKE_DEBUG_TARGET_PROPERTIES",
+ debugProperties);
bool debugDirectories = !this->DebugLinkDirectoriesDone &&
cm::contains(debugProperties, "LINK_DIRECTORIES");
@@ -5811,11 +5787,8 @@ void cmGeneratorTarget::ReportPropertyOrigin(
const std::string& compatibilityType) const
{
std::vector<std::string> debugProperties;
- const char* debugProp = this->Target->GetMakefile()->GetDefinition(
- "CMAKE_DEBUG_TARGET_PROPERTIES");
- if (debugProp) {
- cmExpandList(debugProp, debugProperties);
- }
+ this->Target->GetMakefile()->GetDefExpandList(
+ "CMAKE_DEBUG_TARGET_PROPERTIES", debugProperties);
bool debugOrigin = !this->DebugCompatiblePropertiesDone[p] &&
cm::contains(debugProperties, p);
@@ -7030,6 +7003,13 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
// Skip entries that resolve to the target itself or are empty.
std::string name = this->CheckCMP0004(lib);
+ if (this->GetPolicyStatusCMP0108() == cmPolicies::NEW) {
+ // resolve alias name
+ auto target = this->Makefile->FindTargetToUse(name);
+ if (target) {
+ name = target->GetName();
+ }
+ }
if (name == this->GetName() || name.empty()) {
if (name == this->GetName()) {
bool noMessage = false;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 788fa23..7aa7d32 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -31,7 +31,7 @@ class cmTarget;
struct cmGeneratorExpressionContext;
struct cmGeneratorExpressionDAGChecker;
-using cmProp = const std::string*;
+#include "cmProperty.h"
class cmGeneratorTarget
{
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 0480876..79cbe44 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -7,6 +7,7 @@
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStringAlgorithms.h"
diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx
index 2833977..fa4a40b 100644
--- a/Source/cmGetDirectoryPropertyCommand.cxx
+++ b/Source/cmGetDirectoryPropertyCommand.cxx
@@ -7,6 +7,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmSystemTools.h"
namespace {
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx
index 6b850d1..e5a3669 100644
--- a/Source/cmGetTargetPropertyCommand.cxx
+++ b/Source/cmGetTargetPropertyCommand.cxx
@@ -9,6 +9,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmTarget.h"
#include "cmTargetPropertyComputer.h"
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index a5e496b..358d65a 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -19,6 +19,7 @@
#include "cmLocalGhsMultiGenerator.h"
#include "cmMakefile.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmSourceGroup.h"
diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx
index f57ef04..9dc86f4 100644
--- a/Source/cmGlobalCommonGenerator.cxx
+++ b/Source/cmGlobalCommonGenerator.cxx
@@ -7,6 +7,7 @@
#include "cmGeneratorTarget.h"
#include "cmLocalGenerator.h"
+#include "cmProperty.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index d388224..4dc4092 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -42,6 +42,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmState.h"
@@ -2523,9 +2524,8 @@ void cmGlobalGenerator::AddGlobalTarget_Test(
cmCustomCommandLine singleLine;
singleLine.push_back(cmSystemTools::GetCTestCommand());
singleLine.push_back("--force-new-ctest-process");
- if (auto testArgs = mf->GetDefinition("CMAKE_CTEST_ARGUMENTS")) {
- std::vector<std::string> args;
- cmExpandList(testArgs, args);
+ std::vector<std::string> args;
+ if (mf->GetDefExpandList("CMAKE_CTEST_ARGUMENTS", args)) {
for (auto const& arg : args) {
singleLine.push_back(arg);
}
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 651bfbd..d36adfb 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -19,6 +19,7 @@
#include "cmLocalGenerator.h"
#include "cmLocalGhsMultiGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 5363ea5..c31983b 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -20,6 +20,7 @@
#include "cmMakefile.h"
#include "cmMakefileTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateDirectory.h"
#include "cmStateTypes.h"
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index cda3338..a5ce5d1 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3204,10 +3204,9 @@ std::string cmGlobalXCodeGenerator::GetObjectsDirectory(
void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf)
{
this->Architectures.clear();
- const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES");
const char* sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT");
- if (osxArch && sysroot) {
- cmExpandList(std::string(osxArch), this->Architectures);
+ if (sysroot) {
+ mf->GetDefExpandList("CMAKE_OSX_ARCHITECTURES", this->Architectures);
}
if (this->Architectures.empty()) {
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index ac57bc2..178af73 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -28,6 +28,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSubcommandTable.h"
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 37d8c28..178d5df 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -18,14 +18,13 @@
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmake.h"
-using cmProp = const std::string*; // just to silence IWYU
-
cmInstallTargetGenerator::cmInstallTargetGenerator(
std::string targetName, std::string const& dest, bool implib,
std::string file_permissions, std::vector<std::string> const& configurations,
diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx
index a4f78bc..9f17f15 100644
--- a/Source/cmJsonObjects.cxx
+++ b/Source/cmJsonObjects.cxx
@@ -28,6 +28,7 @@
#include "cmLinkLineComputer.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmSourceFile.h"
#include "cmState.h"
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index eebf328..c50a786 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -15,6 +15,7 @@
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ff05024..3fca2d4 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -34,6 +34,7 @@
#include "cmInstallTargetGenerator.h"
#include "cmLinkLineComputer.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
@@ -1235,11 +1236,10 @@ std::vector<BT<std::string>> cmLocalGenerator::GetIncludeDirectoriesImplicit(
// * Compilers like gfortran do not search their own implicit include
// directories for modules ('.mod' files).
if (lang != "Fortran") {
- const char* value = this->Makefile->GetDefinition(
- cmStrCat("CMAKE_", lang, "_IMPLICIT_INCLUDE_DIRECTORIES"));
- if (value != nullptr) {
- size_t const impDirVecOldSize = impDirVec.size();
- cmExpandList(value, impDirVec);
+ size_t const impDirVecOldSize = impDirVec.size();
+ if (this->Makefile->GetDefExpandList(
+ cmStrCat("CMAKE_", lang, "_IMPLICIT_INCLUDE_DIRECTORIES"),
+ impDirVec)) {
// FIXME: Use cmRange with 'advance()' when it supports non-const.
for (size_t i = impDirVecOldSize; i < impDirVec.size(); ++i) {
cmSystemTools::ConvertToUnixSlashes(impDirVec[i]);
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index e52e0d3..87e8aa4 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -23,6 +23,7 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmNinjaTargetGenerator.h"
+#include "cmProperty.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 4c7c8c4..4545a8e 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -28,6 +28,7 @@
#include "cmMakefile.h"
#include "cmMakefileTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 154da50..c527a49 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2745,6 +2745,18 @@ const std::string& cmMakefile::GetSafeDefinition(const std::string& name) const
return *def;
}
+bool cmMakefile::GetDefExpandList(const std::string& name,
+ std::vector<std::string>& out,
+ bool emptyArgs) const
+{
+ cmProp def = this->GetDef(name);
+ if (!def) {
+ return false;
+ }
+ cmExpandList(*def, out, emptyArgs);
+ return true;
+}
+
std::vector<std::string> cmMakefile::GetDefinitions() const
{
std::vector<std::string> res = this->StateSnapshot.ClosureKeys();
@@ -3273,10 +3285,7 @@ std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs,
bool singleConfig) const
{
if (this->GetGlobalGenerator()->IsMultiConfig()) {
- if (const char* configTypes =
- this->GetDefinition("CMAKE_CONFIGURATION_TYPES")) {
- cmExpandList(configTypes, configs);
- }
+ this->GetDefExpandList("CMAKE_CONFIGURATION_TYPES", configs);
return "";
}
const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 04a1f2d..8dfa5b0 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -26,6 +26,7 @@
#include "cmMessageType.h"
#include "cmNewLineStyle.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmSourceFileLocationKind.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
@@ -58,8 +59,6 @@ class cmTestGenerator;
class cmVariableWatch;
class cmake;
-using cmProp = const std::string*;
-
/** Flag if byproducts shall also be considered. */
enum class cmSourceOutputKind
{
@@ -513,6 +512,8 @@ public:
const std::string& GetSafeDefinition(const std::string&) const;
const std::string& GetRequiredDefinition(const std::string& name) const;
bool IsDefinitionSet(const std::string&) const;
+ bool GetDefExpandList(const std::string& name, std::vector<std::string>& out,
+ bool emptyArgs = false) const;
/**
* Get the list of all variables in the current space. If argument
* cacheonly is specified and is greater than 0, then only cache
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index e15b016..446f225 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -478,9 +478,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
// add it now.
std::string implibRuleVar =
cmStrCat("CMAKE_", linkLanguage, "_CREATE_IMPORT_LIBRARY");
- if (const char* rule = this->Makefile->GetDefinition(implibRuleVar)) {
- cmExpandList(rule, real_link_commands);
- }
+ this->Makefile->GetDefExpandList(implibRuleVar, real_link_commands);
}
bool useResponseFileForObjects =
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 2d360e6..5809b4a 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -642,27 +642,21 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
arCreateVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
arCreateVar, linkLanguage, this->GetConfigName());
- if (const char* rule = this->Makefile->GetDefinition(arCreateVar)) {
- cmExpandList(rule, archiveCreateCommands);
- }
+ this->Makefile->GetDefExpandList(arCreateVar, archiveCreateCommands);
std::string arAppendVar =
cmStrCat("CMAKE_", linkLanguage, "_ARCHIVE_APPEND");
arAppendVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
arAppendVar, linkLanguage, this->GetConfigName());
- if (const char* rule = this->Makefile->GetDefinition(arAppendVar)) {
- cmExpandList(rule, archiveAppendCommands);
- }
+ this->Makefile->GetDefExpandList(arAppendVar, archiveAppendCommands);
std::string arFinishVar =
cmStrCat("CMAKE_", linkLanguage, "_ARCHIVE_FINISH");
arFinishVar = this->GeneratorTarget->GetFeatureSpecificLinkRuleVariable(
arFinishVar, linkLanguage, this->GetConfigName());
- if (const char* rule = this->Makefile->GetDefinition(arFinishVar)) {
- cmExpandList(rule, archiveFinishCommands);
- }
+ this->Makefile->GetDefExpandList(arFinishVar, archiveFinishCommands);
}
// Decide whether to use archiving rules.
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index c98e3a9..8396fa3 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -26,6 +26,7 @@
#include "cmMakefileLibraryTargetGenerator.h"
#include "cmMakefileUtilityTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index f87eba7..b92548f 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -29,6 +29,7 @@
#include "cmNinjaTypes.h"
#include "cmOSXBundleGenerator.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
@@ -453,14 +454,12 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeDeviceLinkCmd()
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
- const std::string cudaLinkCmd(
- this->GetMakefile()->GetDefinition("CMAKE_CUDA_DEVICE_LINK_LIBRARY"));
- cmExpandList(cudaLinkCmd, linkCmds);
+ this->GetMakefile()->GetDefExpandList("CMAKE_CUDA_DEVICE_LINK_LIBRARY",
+ linkCmds);
} break;
case cmStateEnums::EXECUTABLE: {
- const std::string cudaLinkCmd(this->GetMakefile()->GetDefinition(
- "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE"));
- cmExpandList(cudaLinkCmd, linkCmds);
+ this->GetMakefile()->GetDefExpandList(
+ "CMAKE_CUDA_DEVICE_LINK_EXECUTABLE", linkCmds);
} break;
default:
break;
@@ -557,9 +556,8 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
case cmStateEnums::EXECUTABLE:
if (this->TargetLinkLanguage(config) == "Swift") {
if (this->GeneratorTarget->IsExecutableWithExports()) {
- const std::string flags =
- this->Makefile->GetSafeDefinition("CMAKE_EXE_EXPORTS_Swift_FLAG");
- cmExpandList(flags, linkCmds);
+ this->Makefile->GetDefExpandList("CMAKE_EXE_EXPORTS_Swift_FLAG",
+ linkCmds);
}
}
break;
@@ -1027,8 +1025,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
gt->GetFullNameComponents(prefix, base, suffix, config);
std::string dbg_suffix = ".dbg";
// TODO: Where to document?
- if (mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) {
- dbg_suffix = mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX");
+ if (auto d = mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX")) {
+ dbg_suffix = d;
}
vars["TARGET_PDB"] = base + suffix + dbg_suffix;
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index c77a85b..d406c99 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -29,6 +29,7 @@
#include "cmNinjaNormalTargetGenerator.h"
#include "cmNinjaUtilityTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
@@ -749,9 +750,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
if (!mf->GetIsSourceFileTryCompile()) {
rule.DepType = "gcc";
rule.DepFile = "$DEP_FILE";
- const std::string cl = mf->GetDefinition("CMAKE_C_COMPILER")
- ? mf->GetSafeDefinition("CMAKE_C_COMPILER")
- : mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
+ auto d = mf->GetDefinition("CMAKE_C_COMPILER");
+ const std::string cl =
+ d ? d : mf->GetSafeDefinition("CMAKE_CXX_COMPILER");
cldeps = cmStrCat('"', cmSystemTools::GetCMClDepsCommand(), "\" ", lang,
' ', vars.Source, " $DEP_FILE $out \"",
mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX"),
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index b0b7953..8d863c3 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -17,6 +17,7 @@
#include "cmLocalNinjaGenerator.h"
#include "cmNinjaTypes.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx
index a9adf99..a58e2f8 100644
--- a/Source/cmOptionCommand.cxx
+++ b/Source/cmOptionCommand.cxx
@@ -6,6 +6,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index b18c205..aa5abcb 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -15,13 +15,12 @@
#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
-using cmProp = const std::string*;
-
namespace {
/** \class cmDependInformation
* \brief Store dependency information for a single source file.
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 4dff1d8..a82f421 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -318,6 +318,8 @@ class cmMakefile;
SELECT(POLICY, CMP0106, "The Documentation module is removed.", 3, 18, 0, \
cmPolicies::WARN) \
SELECT(POLICY, CMP0107, "An ALIAS target cannot overwrite another target.", \
+ 3, 18, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0108, "A target cannot link to itself through an alias.", \
3, 18, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
@@ -350,7 +352,8 @@ class cmMakefile;
F(CMP0095) \
F(CMP0099) \
F(CMP0104) \
- F(CMP0105)
+ F(CMP0105) \
+ F(CMP0108)
/** \class cmPolicies
* \brief Handles changes in CMake behavior and policies
diff --git a/Source/cmProperty.h b/Source/cmProperty.h
index 80f131a..b0fcce7 100644
--- a/Source/cmProperty.h
+++ b/Source/cmProperty.h
@@ -5,6 +5,8 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <string>
+
class cmProperty
{
public:
@@ -22,4 +24,6 @@ public:
};
};
+using cmProp = const std::string*;
+
#endif
diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h
index 40ac356..5fc46a2 100644
--- a/Source/cmPropertyMap.h
+++ b/Source/cmPropertyMap.h
@@ -10,7 +10,7 @@
#include <utility>
#include <vector>
-using cmProp = const std::string*;
+#include "cmProperty.h"
/** \class cmPropertyMap
* \brief String property map.
diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx
index 48c4b10..795c2ee 100644
--- a/Source/cmQTWrapCPPCommand.cxx
+++ b/Source/cmQTWrapCPPCommand.cxx
@@ -5,6 +5,7 @@
#include "cmCustomCommandLines.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmStringAlgorithms.h"
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index a32f3e7..3d4f5d7 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -13,6 +13,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmProcessOutput.h"
+#include "cmProperty.h"
#include "cmQtAutoGen.h"
#include "cmQtAutoGenInitializer.h"
#include "cmState.h"
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 003a300..511a018 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -35,6 +35,7 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmQtAutoGen.h"
#include "cmQtAutoGenGlobalInitializer.h"
#include "cmSourceFile.h"
@@ -570,9 +571,8 @@ bool cmQtAutoGenInitializer::InitMoc()
if (this->GenTarget->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") &&
(this->QtVersion >= IntegerVersion(5, 8))) {
// Command
- cmExpandList(this->Makefile->GetSafeDefinition(
- "CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"),
- this->Moc.PredefsCmd);
+ this->Makefile->GetDefExpandList("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND",
+ this->Moc.PredefsCmd);
// Header
if (!this->Moc.PredefsCmd.empty()) {
ConfigFileNames(this->Moc.PredefsFile,
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 00ac337..4f7131f 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -20,14 +20,13 @@
#include "cmJsonObjectDictionary.h"
#include "cmJsonObjects.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmServer.h"
#include "cmServerDictionary.h"
#include "cmState.h"
#include "cmSystemTools.h"
#include "cmake.h"
-using cmProp = const std::string*; // just to silence IWYU
-
// Get rid of some windows macros:
#undef max
diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx
index 5c55427..354b4c3 100644
--- a/Source/cmSetCommand.cxx
+++ b/Source/cmSetCommand.cxx
@@ -5,6 +5,7 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmState.h"
#include "cmStateTypes.h"
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index e2dfdc1..e669015 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -11,14 +11,13 @@
#include "cmCustomCommand.h"
#include "cmListFileCache.h"
+#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmSourceFileLocation.h"
#include "cmSourceFileLocationKind.h"
class cmMakefile;
-using cmProp = const std::string*;
-
/** \class cmSourceFile
* \brief Represent a class loaded from a makefile.
*
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 18d8537..0b6b40f 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -26,8 +26,6 @@
#include "cmSystemTools.h"
#include "cmake.h"
-using cmProp = const std::string*;
-
cmState::cmState()
{
this->CacheManager = cm::make_unique<cmCacheManager>();
diff --git a/Source/cmState.h b/Source/cmState.h
index 125e4dd..885496a 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -29,8 +29,6 @@ class cmStateSnapshot;
class cmMessenger;
class cmExecutionStatus;
-using cmProp = const std::string*;
-
class cmState
{
friend class cmStateSnapshot;
diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h
index 8144160..765af6f 100644
--- a/Source/cmStateDirectory.h
+++ b/Source/cmStateDirectory.h
@@ -12,12 +12,11 @@
#include "cmAlgorithms.h"
#include "cmLinkedTree.h"
#include "cmListFileCache.h"
+#include "cmProperty.h"
#include "cmStatePrivate.h"
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"
-using cmProp = const std::string*;
-
class cmStateDirectory
{
cmStateDirectory(
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index d79df6f..c223431 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -11,6 +11,7 @@
#include "cmDefinitions.h"
#include "cmListFileCache.h"
+#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmState.h"
#include "cmStateDirectory.h"
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 6bd47f7..f0ddb68 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -15,6 +15,7 @@
#include "cmAlgorithms.h"
#include "cmListFileCache.h"
#include "cmPolicies.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmTargetLinkLibraryType.h"
@@ -28,8 +29,6 @@ class cmPropertyMap;
class cmSourceFile;
class cmTargetInternals;
-using cmProp = const std::string*;
-
/** \class cmTarget
* \brief Represent a library or executable target loaded from a makefile.
*
diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx
index 6325837..e714720 100644
--- a/Source/cmTargetPropCommandBase.cxx
+++ b/Source/cmTargetPropCommandBase.cxx
@@ -5,12 +5,11 @@
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmTarget.h"
#include "cmake.h"
-using cmProp = const std::string*;
-
cmTargetPropCommandBase::cmTargetPropCommandBase(cmExecutionStatus& status)
: Makefile(&status.GetMakefile())
, Status(status)
diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h
index 5387e00..f87b7c2 100644
--- a/Source/cmTargetPropertyComputer.h
+++ b/Source/cmTargetPropertyComputer.h
@@ -8,14 +8,13 @@
#include <string>
#include "cmListFileCache.h"
+#include "cmProperty.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
class cmMessenger;
-using cmProp = const std::string*;
-
class cmTargetPropertyComputer
{
public:
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 4e41993..e10a8e2 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -12,6 +12,7 @@
#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmOutputConverter.h"
+#include "cmProperty.h"
#include "cmPropertyMap.h"
#include "cmRange.h"
#include "cmStateTypes.h"
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 329b3b9..64d71bc 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -9,6 +9,7 @@
#include "cmDuration.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmRange.h"
#include "cmState.h"
#include "cmStateTypes.h"
diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx
index 5865a19..6de78ff 100644
--- a/Source/cmUtilitySourceCommand.cxx
+++ b/Source/cmUtilitySourceCommand.cxx
@@ -84,8 +84,8 @@ bool cmUtilitySourceCommand(std::vector<std::string> const& args,
std::string utilityDirectory =
status.GetMakefile().GetCurrentBinaryDirectory();
std::string exePath;
- if (status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH")) {
- exePath = status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH");
+ if (auto d = status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH")) {
+ exePath = d;
}
if (!exePath.empty()) {
utilityDirectory = exePath;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 65d5f10..162e807 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2286,9 +2286,7 @@ int cmake::CheckBuildSystem()
// If any byproduct of makefile generation is missing we must re-run.
std::vector<std::string> products;
- if (const char* productStr = mf.GetDefinition("CMAKE_MAKEFILE_PRODUCTS")) {
- cmExpandList(productStr, products);
- }
+ mf.GetDefExpandList("CMAKE_MAKEFILE_PRODUCTS", products);
for (std::string const& p : products) {
if (!(cmSystemTools::FileExists(p) || cmSystemTools::FileIsSymlink(p))) {
if (verbose) {
@@ -2303,11 +2301,8 @@ int cmake::CheckBuildSystem()
// Get the set of dependencies and outputs.
std::vector<std::string> depends;
std::vector<std::string> outputs;
- const char* dependsStr = mf.GetDefinition("CMAKE_MAKEFILE_DEPENDS");
- const char* outputsStr = mf.GetDefinition("CMAKE_MAKEFILE_OUTPUTS");
- if (dependsStr && outputsStr) {
- cmExpandList(dependsStr, depends);
- cmExpandList(outputsStr, outputs);
+ if (mf.GetDefExpandList("CMAKE_MAKEFILE_DEPENDS", depends)) {
+ mf.GetDefExpandList("CMAKE_MAKEFILE_OUTPUTS", outputs);
}
if (depends.empty() || outputs.empty()) {
// Not enough information was provided to do the test. Just rerun.
diff --git a/Source/cmake.h b/Source/cmake.h
index cd152cb..086ec87 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -22,6 +22,7 @@
#include "cmInstalledFile.h"
#include "cmListFileCache.h"
#include "cmMessageType.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index b12990b..75280fb 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -18,6 +18,7 @@
#include "cmDocumentationEntry.h" // IWYU pragma: keep
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
+#include "cmProperty.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index 2d270c5..2454f25 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -31,6 +31,7 @@
\* CMP0099
\* CMP0104
\* CMP0105
+ \* CMP0108
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-result.txt b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-stderr.txt
new file mode 100644
index 0000000..7389eff
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at CMP0108-self-link.cmake:[0-9]+ \(add_library\):
+ Target "foo" links to itself.
+Call Stack \(most recent call first\):
+ CMP0108-NEW-self-link.cmake:[0-9]+ \(include\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link.cmake b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link.cmake
new file mode 100644
index 0000000..4ee9621
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0108-NEW-self-link.cmake
@@ -0,0 +1,4 @@
+
+cmake_policy (SET CMP0108 NEW)
+
+include (CMP0108-self-link.cmake)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link.cmake b/Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link.cmake
new file mode 100644
index 0000000..813104a
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0108-OLD-self-link.cmake
@@ -0,0 +1,4 @@
+
+cmake_policy (SET CMP0108 OLD)
+
+include (CMP0108-self-link.cmake)
diff --git a/Tests/RunCMake/target_link_libraries/CMP0108-self-link.cmake b/Tests/RunCMake/target_link_libraries/CMP0108-self-link.cmake
new file mode 100644
index 0000000..07a3490
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/CMP0108-self-link.cmake
@@ -0,0 +1,9 @@
+
+cmake_policy (SET CMP0038 NEW)
+cmake_policy (SET CMP0042 NEW)
+
+enable_language(C)
+
+add_library(foo SHARED lib.c)
+add_library(Bar::foo ALIAS foo)
+target_link_libraries(foo PRIVATE Bar::foo)
diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
index fb223ab..dfa71dd 100644
--- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
@@ -19,6 +19,8 @@ run_cmake(CMP0079-link-WARN)
run_cmake(CMP0079-link-OLD)
run_cmake(CMP0079-link-NEW)
run_cmake(CMP0079-link-NEW-bogus)
+run_cmake(CMP0108-OLD-self-link)
+run_cmake(CMP0108-NEW-self-link)
run_cmake(ImportedTarget)
run_cmake(ImportedTargetFailure)
run_cmake(MixedSignature)