summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/command/install.rst2
-rw-r--r--Help/policy/CMP0112.rst4
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmExportFileGenerator.cxx28
-rw-r--r--Source/cmExportFileGenerator.h4
-rw-r--r--Source/cmGeneratorTarget.h6
-rw-r--r--Templates/MSBuild/FlagTables/v10_CL.json11
-rw-r--r--Templates/MSBuild/FlagTables/v11_CL.json11
-rw-r--r--Templates/MSBuild/FlagTables/v12_CL.json11
-rw-r--r--Templates/MSBuild/FlagTables/v140_CL.json11
-rw-r--r--Templates/MSBuild/FlagTables/v141_CL.json11
-rw-r--r--Templates/MSBuild/FlagTables/v142_CL.json11
-rw-r--r--Templates/MSBuild/FlagTables/v143_CL.json11
-rw-r--r--Tests/ExportImport/Export/SubDirLinkA/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/VS10Project/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/VS10Project/VsForceInclude-check.cmake18
-rw-r--r--Tests/RunCMake/VS10Project/VsForceInclude.cmake5
17 files changed, 132 insertions, 20 deletions
diff --git a/Help/command/install.rst b/Help/command/install.rst
index 14f7ff7..1a9dfd7 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -828,7 +828,7 @@ of the ``Development`` component in the package metadata, ensuring that the
library is always installed if the headers and CMake export file are present.
.. versionadded:: 3.7
- In addition to cmake language files, the ``EXPORT_ANDROID_MK`` mode maybe
+ In addition to cmake language files, the ``EXPORT_ANDROID_MK`` mode may be
used to specify an export to the android ndk build system. This mode
accepts the same options as the normal export mode. The Android
NDK supports the use of prebuilt libraries, both static and shared. This
diff --git a/Help/policy/CMP0112.rst b/Help/policy/CMP0112.rst
index 313a51e..5b00d07 100644
--- a/Help/policy/CMP0112.rst
+++ b/Help/policy/CMP0112.rst
@@ -24,7 +24,9 @@ file name components no longer add a dependency on the evaluated target.
In CMake 3.18 and lower a dependency on the evaluated target of the above
generator expressions would always be added. CMake 3.19 and above prefer
to not add this dependency. This policy provides compatibility for projects
-that have not been updated to expect the new behavior.
+that have not been updated to expect the new behavior. The policy setting
+is recorded on each target when it is created, and decides whether generator
+expressions referencing that target imply a dependency on it.
The ``OLD`` behavior for this policy is to add a dependency on the evaluated
target for the above generator expressions. The ``NEW`` behavior of
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index db5121b..5e43398 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 23)
-set(CMake_VERSION_PATCH 20220401)
+set(CMake_VERSION_PATCH 20220404)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index a21e614..dc94e76 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -16,7 +16,6 @@
#include "cmFileSet.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
-#include "cmGlobalGenerator.h"
#include "cmLinkItem.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
@@ -607,10 +606,10 @@ void cmExportFileGenerator::GenerateInterfaceProperties(
bool cmExportFileGenerator::AddTargetNamespace(
std::string& input, cmGeneratorTarget const* target,
- std::vector<std::string>& missingTargets)
+ cmLocalGenerator const* lg, std::vector<std::string>& missingTargets)
{
cmGeneratorTarget::TargetOrString resolved =
- target->ResolveTargetReference(input);
+ target->ResolveTargetReference(input, lg);
cmGeneratorTarget* tgt = resolved.Target;
if (!tgt) {
@@ -640,8 +639,10 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
std::string& input, cmGeneratorTarget const* target,
std::vector<std::string>& missingTargets, FreeTargetsReplace replace)
{
+ cmLocalGenerator const* lg = target->GetLocalGenerator();
if (replace == NoReplaceFreeTargets) {
- this->ResolveTargetsInGeneratorExpression(input, target, missingTargets);
+ this->ResolveTargetsInGeneratorExpression(input, target, lg,
+ missingTargets);
return;
}
std::vector<std::string> parts;
@@ -650,13 +651,14 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
std::string sep;
input.clear();
for (std::string& li : parts) {
- if (cmHasLiteralPrefix(li, CMAKE_DIRECTORY_ID_SEP)) {
+ if (target->IsLinkLookupScope(li, lg)) {
continue;
}
if (cmGeneratorExpression::Find(li) == std::string::npos) {
- this->AddTargetNamespace(li, target, missingTargets);
+ this->AddTargetNamespace(li, target, lg, missingTargets);
} else {
- this->ResolveTargetsInGeneratorExpression(li, target, missingTargets);
+ this->ResolveTargetsInGeneratorExpression(li, target, lg,
+ missingTargets);
}
input += sep + li;
sep = ";";
@@ -665,7 +667,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
std::string& input, cmGeneratorTarget const* target,
- std::vector<std::string>& missingTargets)
+ cmLocalGenerator const* lg, std::vector<std::string>& missingTargets)
{
std::string::size_type pos = 0;
std::string::size_type lastPos = pos;
@@ -689,7 +691,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
std::string targetName =
input.substr(nameStartPos, commaPos - nameStartPos);
- if (this->AddTargetNamespace(targetName, target, missingTargets)) {
+ if (this->AddTargetNamespace(targetName, target, lg, missingTargets)) {
input.replace(nameStartPos, commaPos - nameStartPos, targetName);
}
lastPos = nameStartPos + targetName.size() + 1;
@@ -711,7 +713,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
"literal.";
break;
}
- if (!this->AddTargetNamespace(targetName, target, missingTargets)) {
+ if (!this->AddTargetNamespace(targetName, target, lg, missingTargets)) {
errorString = "$<TARGET_NAME:...> requires its parameter to be a "
"reachable target.";
break;
@@ -732,7 +734,7 @@ void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
}
std::string libName = input.substr(nameStartPos, endPos - nameStartPos);
if (cmGeneratorExpression::IsValidTargetName(libName) &&
- this->AddTargetNamespace(libName, target, missingTargets)) {
+ this->AddTargetNamespace(libName, target, lg, missingTargets)) {
input.replace(nameStartPos, endPos - nameStartPos, libName);
}
lastPos = nameStartPos + libName.size() + 1;
@@ -900,6 +902,8 @@ void cmExportFileGenerator::SetImportLinkProperty(
return;
}
+ cmLocalGenerator const* lg = target->GetLocalGenerator();
+
// Construct the property value.
std::string link_entries;
const char* sep = "";
@@ -910,7 +914,7 @@ void cmExportFileGenerator::SetImportLinkProperty(
if (targetNames == ImportLinkPropertyTargetNames::Yes) {
std::string temp = asString(l);
- this->AddTargetNamespace(temp, target, missingTargets);
+ this->AddTargetNamespace(temp, target, lg, missingTargets);
link_entries += temp;
} else {
link_entries += asString(l);
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index d50f7e8..bde6f1b 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -17,6 +17,7 @@
class cmFileSet;
class cmGeneratorTarget;
+class cmLocalGenerator;
class cmTargetExport;
#define STRINGIFY_HELPER(X) #X
@@ -223,11 +224,12 @@ private:
std::vector<std::string>& missingTargets);
bool AddTargetNamespace(std::string& input, cmGeneratorTarget const* target,
+ cmLocalGenerator const* lg,
std::vector<std::string>& missingTargets);
void ResolveTargetsInGeneratorExpression(
std::string& input, cmGeneratorTarget const* target,
- std::vector<std::string>& missingTargets);
+ cmLocalGenerator const* lg, std::vector<std::string>& missingTargets);
virtual void ReplaceInstallPrefix(std::string& input);
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 53844ae..b927848 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -856,6 +856,9 @@ public:
std::string GetFortranModuleDirectory(std::string const& working_dir) const;
bool IsFortranBuildingInstrinsicModules() const;
+ bool IsLinkLookupScope(std::string const& n,
+ cmLocalGenerator const*& lg) const;
+
cmValue GetSourcesProperty() const;
void AddISPCGeneratedHeader(std::string const& header,
@@ -1073,9 +1076,6 @@ private:
std::unordered_map<std::string, std::vector<std::string>>
ISPCGeneratedObjects;
- bool IsLinkLookupScope(std::string const& n,
- cmLocalGenerator const*& lg) const;
-
enum class LinkInterfaceField
{
Libraries,
diff --git a/Templates/MSBuild/FlagTables/v10_CL.json b/Templates/MSBuild/FlagTables/v10_CL.json
index 06158be..a8c2cc7 100644
--- a/Templates/MSBuild/FlagTables/v10_CL.json
+++ b/Templates/MSBuild/FlagTables/v10_CL.json
@@ -860,6 +860,17 @@
"value": "",
"flags": [
"UserValue",
+ "UserRequired",
+ "SemicolonAppendable"
+ ]
+ },
+ {
+ "name": "ForcedIncludeFiles",
+ "switch": "FI",
+ "comment": "Forced Include File",
+ "value": "",
+ "flags": [
+ "UserFollowing",
"SemicolonAppendable"
]
},
diff --git a/Templates/MSBuild/FlagTables/v11_CL.json b/Templates/MSBuild/FlagTables/v11_CL.json
index b47ab2e..bb64985 100644
--- a/Templates/MSBuild/FlagTables/v11_CL.json
+++ b/Templates/MSBuild/FlagTables/v11_CL.json
@@ -923,6 +923,17 @@
"value": "",
"flags": [
"UserValue",
+ "UserRequired",
+ "SemicolonAppendable"
+ ]
+ },
+ {
+ "name": "ForcedIncludeFiles",
+ "switch": "FI",
+ "comment": "Forced Include File",
+ "value": "",
+ "flags": [
+ "UserFollowing",
"SemicolonAppendable"
]
},
diff --git a/Templates/MSBuild/FlagTables/v12_CL.json b/Templates/MSBuild/FlagTables/v12_CL.json
index 771a555..5bc61fd 100644
--- a/Templates/MSBuild/FlagTables/v12_CL.json
+++ b/Templates/MSBuild/FlagTables/v12_CL.json
@@ -937,6 +937,17 @@
"value": "",
"flags": [
"UserValue",
+ "UserRequired",
+ "SemicolonAppendable"
+ ]
+ },
+ {
+ "name": "ForcedIncludeFiles",
+ "switch": "FI",
+ "comment": "Forced Include File",
+ "value": "",
+ "flags": [
+ "UserFollowing",
"SemicolonAppendable"
]
},
diff --git a/Templates/MSBuild/FlagTables/v140_CL.json b/Templates/MSBuild/FlagTables/v140_CL.json
index 3dc9f35..58e22ba 100644
--- a/Templates/MSBuild/FlagTables/v140_CL.json
+++ b/Templates/MSBuild/FlagTables/v140_CL.json
@@ -972,6 +972,17 @@
"value": "",
"flags": [
"UserValue",
+ "UserRequired",
+ "SemicolonAppendable"
+ ]
+ },
+ {
+ "name": "ForcedIncludeFiles",
+ "switch": "FI",
+ "comment": "Forced Include File",
+ "value": "",
+ "flags": [
+ "UserFollowing",
"SemicolonAppendable"
]
},
diff --git a/Templates/MSBuild/FlagTables/v141_CL.json b/Templates/MSBuild/FlagTables/v141_CL.json
index 5b18e32..604e6b6 100644
--- a/Templates/MSBuild/FlagTables/v141_CL.json
+++ b/Templates/MSBuild/FlagTables/v141_CL.json
@@ -1077,6 +1077,17 @@
"value": "",
"flags": [
"UserValue",
+ "UserRequired",
+ "SemicolonAppendable"
+ ]
+ },
+ {
+ "name": "ForcedIncludeFiles",
+ "switch": "FI",
+ "comment": "Forced Include File",
+ "value": "",
+ "flags": [
+ "UserFollowing",
"SemicolonAppendable"
]
},
diff --git a/Templates/MSBuild/FlagTables/v142_CL.json b/Templates/MSBuild/FlagTables/v142_CL.json
index 4c65ad9..c76c040 100644
--- a/Templates/MSBuild/FlagTables/v142_CL.json
+++ b/Templates/MSBuild/FlagTables/v142_CL.json
@@ -1286,6 +1286,17 @@
"value": "",
"flags": [
"UserValue",
+ "UserRequired",
+ "SemicolonAppendable"
+ ]
+ },
+ {
+ "name": "ForcedIncludeFiles",
+ "switch": "FI",
+ "comment": "Forced Include File",
+ "value": "",
+ "flags": [
+ "UserFollowing",
"SemicolonAppendable"
]
},
diff --git a/Templates/MSBuild/FlagTables/v143_CL.json b/Templates/MSBuild/FlagTables/v143_CL.json
index 96f74b1..993fbf1 100644
--- a/Templates/MSBuild/FlagTables/v143_CL.json
+++ b/Templates/MSBuild/FlagTables/v143_CL.json
@@ -1285,6 +1285,17 @@
"value": "",
"flags": [
"UserValue",
+ "UserRequired",
+ "SemicolonAppendable"
+ ]
+ },
+ {
+ "name": "ForcedIncludeFiles",
+ "switch": "FI",
+ "comment": "Forced Include File",
+ "value": "",
+ "flags": [
+ "UserFollowing",
"SemicolonAppendable"
]
},
diff --git a/Tests/ExportImport/Export/SubDirLinkA/CMakeLists.txt b/Tests/ExportImport/Export/SubDirLinkA/CMakeLists.txt
index 1aa41d2..ccba264 100644
--- a/Tests/ExportImport/Export/SubDirLinkA/CMakeLists.txt
+++ b/Tests/ExportImport/Export/SubDirLinkA/CMakeLists.txt
@@ -1,6 +1,9 @@
add_library(SubDirLinkAImported IMPORTED INTERFACE)
target_compile_definitions(SubDirLinkAImported INTERFACE DEF_SubDirLinkAImportedForExport)
-target_link_libraries(TopDirLib PUBLIC debug "$<1:SubDirLinkAImported;SubDirLinkAImported>" optimized "$<1:SubDirLinkAImported;SubDirLinkAImported>")
+target_link_libraries(TopDirLib PUBLIC
+ debug "$<1:$<TARGET_NAME:SubDirLinkAImported>;$<TARGET_NAME:SubDirLinkAImported>>"
+ optimized "$<1:$<TARGET_NAME:SubDirLinkAImported>;$<TARGET_NAME:SubDirLinkAImported>>"
+)
add_library(SubDirLinkA STATIC SubDirLinkA.c)
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index b19c1a8..273b9d5 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -35,6 +35,7 @@ run_cmake(VsProjectImport)
run_cmake(VsPackageReferences)
run_cmake(VsDpiAware)
run_cmake(VsDpiAwareBadParam)
+run_cmake(VsForceInclude)
run_cmake(VsPrecompileHeaders)
run_cmake(VsPrecompileHeadersReuseFromCompilePDBName)
run_cmake(VsDeployEnabled)
diff --git a/Tests/RunCMake/VS10Project/VsForceInclude-check.cmake b/Tests/RunCMake/VS10Project/VsForceInclude-check.cmake
new file mode 100644
index 0000000..8906e92
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsForceInclude-check.cmake
@@ -0,0 +1,18 @@
+set(tgt_project "${RunCMake_TEST_BINARY_DIR}/tgt.vcxproj")
+if (NOT EXISTS "${tgt_project}")
+ set(RunCMake_TEST_FAILED "Generated project file does not exist:\n ${tgt_project}\n")
+ return()
+endif()
+
+file(STRINGS ${tgt_project} tgt_projects_strings REGEX ForcedIncludeFiles)
+
+foreach(line IN LISTS tgt_projects_strings)
+ if (line MATCHES "<ForcedIncludeFiles>force_include_1.h;force_include_2.h</ForcedIncludeFiles>")
+ set(have_FI ON)
+ endif()
+endforeach()
+
+if (NOT have_FI)
+ set(RunCMake_TEST_FAILED "Generated project does not have expected ForcedIncludeFiles.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsForceInclude.cmake b/Tests/RunCMake/VS10Project/VsForceInclude.cmake
new file mode 100644
index 0000000..fa1f544
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsForceInclude.cmake
@@ -0,0 +1,5 @@
+enable_language(CXX)
+
+add_library(tgt STATIC empty.cxx)
+target_compile_options(tgt PRIVATE "SHELL:/FI force_include_1.h")
+target_compile_options(tgt PRIVATE "/FIforce_include_2.h")