summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/ExternalProject.cmake4
-rw-r--r--Modules/FindSquish.cmake2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmCMakeCommand.cxx25
-rw-r--r--Source/cmCMakeCommand.h4
-rw-r--r--Source/cmGeneratorTarget.cxx128
-rw-r--r--Source/cmGeneratorTarget.h1
-rw-r--r--Source/cmLinkItem.h6
-rw-r--r--Source/kwsys/CommandLineArguments.cxx6
-rw-r--r--Source/kwsys/EncodingCXX.cxx4
-rw-r--r--Source/kwsys/Glob.cxx6
-rw-r--r--Source/kwsys/RegularExpression.cxx7
-rw-r--r--Source/kwsys/SystemInformation.cxx26
-rw-r--r--Source/kwsys/SystemTools.cxx37
-rw-r--r--Source/kwsys/SystemTools.hxx.in3
-rw-r--r--Source/kwsys/testCommandLineArguments.cxx4
-rw-r--r--Source/kwsys/testCommandLineArguments1.cxx8
-rw-r--r--Source/kwsys/testDynload.c2
-rw-r--r--Source/kwsys/testEncoding.cxx8
-rw-r--r--Source/kwsys/testFStream.cxx2
-rw-r--r--Source/kwsys/testSystemTools.cxx16
-rw-r--r--Tests/ConfigSources/CMakeLists.txt38
-rw-r--r--Tests/ConfigSources/main.cpp9
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt14
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt2
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt2
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake19
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake3
-rw-r--r--Tests/RunCMake/BuildDepends/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/cmake_command/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments-stderr.txt6
-rw-r--r--Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments.cmake12
33 files changed, 283 insertions, 132 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 75f68c8..f9f7a4f 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -2989,6 +2989,10 @@ function(_ep_extract_configure_command var name)
endif()
_ep_write_initial_cache(${name} "${_ep_cache_args_script}" "${script_initial_cache_force}${script_initial_cache_default}")
list(APPEND cmd "-C${_ep_cache_args_script}")
+ _ep_replace_location_tags(${name} _ep_cache_args_script)
+ set(_ep_cache_args_script
+ "${_ep_cache_args_script}"
+ PARENT_SCOPE)
endif()
list(APPEND cmd "<SOURCE_DIR><SOURCE_SUBDIR>")
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
index eec8876..f4d4f29 100644
--- a/Modules/FindSquish.cmake
+++ b/Modules/FindSquish.cmake
@@ -277,7 +277,7 @@ function(SQUISH_V4_ADD_TEST testName)
add_test(NAME ${testName}
COMMAND ${CMAKE_COMMAND} -V -VV
"-Dsquish_version:STRING=4"
- "-Dsquish_aut:STRING=$<TARGET_FILE_NAME:${_SQUISH_AUT}>"
+ "-Dsquish_aut:STRING=$<TARGET_FILE_BASE_NAME:${_SQUISH_AUT}>"
"-Dsquish_aut_dir:STRING=$<TARGET_FILE_DIR:${_SQUISH_AUT}>"
"-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}"
"-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}"
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 8dbfe33..f7f30b8 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 17)
-set(CMake_VERSION_PATCH 20200513)
+set(CMake_VERSION_PATCH 20200514)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/cmCMakeCommand.cxx b/Source/cmCMakeCommand.cxx
index c11a003..da15b1a 100644
--- a/Source/cmCMakeCommand.cxx
+++ b/Source/cmCMakeCommand.cxx
@@ -4,6 +4,9 @@
#include <algorithm>
#include <cstddef>
+#include <iosfwd>
+#include <memory>
+#include <string>
#include "cmExecutionStatus.h"
#include "cmListFileCache.h"
@@ -11,7 +14,14 @@
#include "cmRange.h"
#include "cmStringAlgorithms.h"
-bool cmCMakeCommand(std::vector<std::string> const& args,
+inline std::ostream& operator<<(std::ostream& os,
+ cmListFileArgument const& arg)
+{
+ os << arg.Value;
+ return os;
+}
+
+bool cmCMakeCommand(std::vector<cmListFileArgument> const& args,
cmExecutionStatus& status)
{
if (args.empty()) {
@@ -24,7 +34,7 @@ bool cmCMakeCommand(std::vector<std::string> const& args,
bool result = false;
- if (args[0] == "INVOKE") {
+ if (args[0].Value == "INVOKE") {
if (args.size() == 1) {
status.SetError("called with incorrect number of arguments");
return false;
@@ -32,26 +42,29 @@ bool cmCMakeCommand(std::vector<std::string> const& args,
// First argument is the name of the function to call
cmListFileFunction func;
- func.Name = args[1];
+ func.Name = args[1].Value;
func.Line = context.Line;
// The rest of the arguments are passed to the function call above
func.Arguments.resize(args.size() - 1);
for (size_t i = 2; i < args.size(); ++i) {
cmListFileArgument lfarg;
+ lfarg.Delim = args[i].Delim;
lfarg.Line = context.Line;
- lfarg.Value = args[i];
+ lfarg.Value = args[i].Value;
func.Arguments.emplace_back(lfarg);
}
result = makefile.ExecuteCommand(func, status);
- } else if (args[0] == "EVAL") {
+ } else if (args[0].Value == "EVAL") {
if (args.size() < 2) {
status.SetError("called with incorrect number of arguments");
return false;
}
- auto code_iter = std::find(args.begin(), args.end(), "CODE");
+ auto code_iter = std::find_if(
+ args.begin(), args.end(),
+ [](cmListFileArgument const& arg) { return arg.Value == "CODE"; });
if (code_iter == args.end()) {
status.SetError("called without CODE argument");
return false;
diff --git a/Source/cmCMakeCommand.h b/Source/cmCMakeCommand.h
index cf9f4c3..7dbecff 100644
--- a/Source/cmCMakeCommand.h
+++ b/Source/cmCMakeCommand.h
@@ -5,16 +5,16 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#include <string>
#include <vector>
class cmExecutionStatus;
+struct cmListFileArgument;
/**
* \brief Calls a scripted or build-in command
*
*/
-bool cmCMakeCommand(std::vector<std::string> const& args,
+bool cmCMakeCommand(std::vector<cmListFileArgument> const& args,
cmExecutionStatus& status);
#endif
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 62427f6..a44126c 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -238,17 +238,23 @@ EvaluatedTargetPropertyEntry EvaluateTargetPropertyEntry(
return ee;
}
-std::vector<EvaluatedTargetPropertyEntry> EvaluateTargetPropertyEntries(
+struct EvaluatedTargetPropertyEntries
+{
+ std::vector<EvaluatedTargetPropertyEntry> Entries;
+ bool HadContextSensitiveCondition = false;
+};
+
+EvaluatedTargetPropertyEntries EvaluateTargetPropertyEntries(
cmGeneratorTarget const* thisTarget, std::string const& config,
std::string const& lang, cmGeneratorExpressionDAGChecker* dagChecker,
std::vector<std::unique_ptr<cmGeneratorTarget::TargetPropertyEntry>> const&
in)
{
- std::vector<EvaluatedTargetPropertyEntry> out;
- out.reserve(in.size());
+ EvaluatedTargetPropertyEntries out;
+ out.Entries.reserve(in.size());
for (auto& entry : in) {
- out.emplace_back(EvaluateTargetPropertyEntry(thisTarget, config, lang,
- dagChecker, *entry));
+ out.Entries.emplace_back(EvaluateTargetPropertyEntry(
+ thisTarget, config, lang, dagChecker, *entry));
}
return out;
}
@@ -1246,6 +1252,9 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
if (cmLinkInterfaceLibraries const* iface = this->GetLinkInterfaceLibraries(
context->Config, headTarget, usage_requirements_only)) {
+ context->HadContextSensitiveCondition =
+ context->HadContextSensitiveCondition ||
+ iface->HadContextSensitiveCondition;
for (cmLinkItem const& lib : iface->Libraries) {
// Broken code can have a target in its own link interface.
// Don't follow such link interface entries so as not to create a
@@ -1333,7 +1342,7 @@ std::string AddSwiftInterfaceIncludeDirectories(
void AddSwiftImplicitIncludeDirectories(
const cmGeneratorTarget* target, const std::string& config,
- std::vector<EvaluatedTargetPropertyEntry>& entries)
+ EvaluatedTargetPropertyEntries& entries)
{
if (const auto* libraries = target->GetLinkImplementationLibraries(config)) {
cmGeneratorExpressionDAGChecker dag{ target->GetBacktrace(), target,
@@ -1357,7 +1366,7 @@ void AddSwiftImplicitIncludeDirectories(
config, &dag),
entry.Values);
- entries.emplace_back(std::move(entry));
+ entries.Entries.emplace_back(std::move(entry));
}
}
}
@@ -1368,11 +1377,12 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
std::string const& config, std::string const& prop,
std::string const& lang,
cmGeneratorExpressionDAGChecker* dagChecker,
- std::vector<EvaluatedTargetPropertyEntry>& entries,
+ EvaluatedTargetPropertyEntries& entries,
bool usage_requirements_only = true)
{
if (cmLinkImplementationLibraries const* impl =
headTarget->GetLinkImplementationLibraries(config)) {
+ entries.HadContextSensitiveCondition = impl->HadContextSensitiveCondition;
for (cmLinkImplItem const& lib : impl->Libraries) {
if (lib.Target) {
EvaluatedTargetPropertyEntry ee(lib, lib.Backtrace);
@@ -1386,7 +1396,7 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
prop, &context, dagChecker, usage_requirements_only),
ee.Values);
ee.ContextDependent = context.HadContextSensitiveCondition;
- entries.emplace_back(std::move(ee));
+ entries.Entries.emplace_back(std::move(ee));
}
}
}
@@ -1395,10 +1405,11 @@ void AddInterfaceEntries(cmGeneratorTarget const* headTarget,
void AddObjectEntries(cmGeneratorTarget const* headTarget,
std::string const& config,
cmGeneratorExpressionDAGChecker* dagChecker,
- std::vector<EvaluatedTargetPropertyEntry>& entries)
+ EvaluatedTargetPropertyEntries& entries)
{
if (cmLinkImplementationLibraries const* impl =
headTarget->GetLinkImplementationLibraries(config)) {
+ entries.HadContextSensitiveCondition = impl->HadContextSensitiveCondition;
for (cmLinkImplItem const& lib : impl->Libraries) {
if (lib.Target &&
lib.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
@@ -1417,23 +1428,23 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
if (cge->GetHadContextSensitiveCondition()) {
ee.ContextDependent = true;
}
- entries.emplace_back(std::move(ee));
+ entries.Entries.emplace_back(std::move(ee));
}
}
}
}
bool processSources(cmGeneratorTarget const* tgt,
- std::vector<EvaluatedTargetPropertyEntry>& entries,
+ EvaluatedTargetPropertyEntries& entries,
std::vector<BT<std::string>>& srcs,
std::unordered_set<std::string>& uniqueSrcs,
bool debugSources)
{
cmMakefile* mf = tgt->Target->GetMakefile();
- bool contextDependent = false;
+ bool contextDependent = entries.HadContextSensitiveCondition;
- for (EvaluatedTargetPropertyEntry& entry : entries) {
+ for (EvaluatedTargetPropertyEntry& entry : entries.Entries) {
if (entry.ContextDependent) {
contextDependent = true;
}
@@ -1534,16 +1545,15 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
cmGeneratorExpressionDAGChecker dagChecker(this, "SOURCES", nullptr,
nullptr);
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, std::string(), &dagChecker,
- this->SourceEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, std::string(), &dagChecker, this->SourceEntries);
std::unordered_set<std::string> uniqueSrcs;
bool contextDependentDirectSources =
processSources(this, entries, files, uniqueSrcs, debugSources);
// Collect INTERFACE_SOURCES of all direct link-dependencies.
- std::vector<EvaluatedTargetPropertyEntry> linkInterfaceSourcesEntries;
+ EvaluatedTargetPropertyEntries linkInterfaceSourcesEntries;
AddInterfaceEntries(this, config, "INTERFACE_SOURCES", std::string(),
&dagChecker, linkInterfaceSourcesEntries);
std::vector<std::string>::size_type numFilesBefore = files.size();
@@ -1554,7 +1564,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
bool contextDependentObjects = false;
std::vector<std::string>::size_type numFilesBefore2 = files.size();
if (this->GetType() != cmStateEnums::OBJECT_LIBRARY) {
- std::vector<EvaluatedTargetPropertyEntry> linkObjectsEntries;
+ EvaluatedTargetPropertyEntries linkObjectsEntries;
AddObjectEntries(this, config, &dagChecker, linkObjectsEntries);
contextDependentObjects = processSources(this, linkObjectsEntries, files,
uniqueSrcs, debugSources);
@@ -3216,13 +3226,13 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
}
namespace {
-void processIncludeDirectories(
- cmGeneratorTarget const* tgt,
- std::vector<EvaluatedTargetPropertyEntry>& entries,
- std::vector<BT<std::string>>& includes,
- std::unordered_set<std::string>& uniqueIncludes, bool debugIncludes)
+void processIncludeDirectories(cmGeneratorTarget const* tgt,
+ EvaluatedTargetPropertyEntries& entries,
+ std::vector<BT<std::string>>& includes,
+ std::unordered_set<std::string>& uniqueIncludes,
+ bool debugIncludes)
{
- for (EvaluatedTargetPropertyEntry& entry : entries) {
+ for (EvaluatedTargetPropertyEntry& entry : entries.Entries) {
cmLinkImplItem const& item = entry.LinkImplItem;
std::string const& targetName = item.AsStr();
bool const fromImported = item.Target && item.Target->IsImported();
@@ -3343,9 +3353,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
this->DebugIncludesDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, lang, &dagChecker,
- this->IncludeDirectoriesEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, lang, &dagChecker, this->IncludeDirectoriesEntries);
if (lang == "Swift") {
AddSwiftImplicitIncludeDirectories(this, config, entries);
@@ -3371,7 +3380,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
EvaluatedTargetPropertyEntry ee(lib, cmListFileBacktrace());
ee.Values.emplace_back(std::move(libDir));
- entries.emplace_back(std::move(ee));
+ entries.Entries.emplace_back(std::move(ee));
}
}
@@ -3392,14 +3401,14 @@ const auto DL_BEGIN = "<DEVICE_LINK>"_s;
const auto DL_END = "</DEVICE_LINK>"_s;
void processOptions(cmGeneratorTarget const* tgt,
- std::vector<EvaluatedTargetPropertyEntry> const& entries,
+ EvaluatedTargetPropertyEntries const& entries,
std::vector<BT<std::string>>& options,
std::unordered_set<std::string>& uniqueOptions,
bool debugOptions, const char* logName, OptionsParse parse,
bool processDeviceOptions = false)
{
bool splitOption = !processDeviceOptions;
- for (EvaluatedTargetPropertyEntry const& entry : entries) {
+ for (EvaluatedTargetPropertyEntry const& entry : entries.Entries) {
std::string usedOptions;
for (std::string const& opt : entry.Values) {
if (processDeviceOptions && (opt == DL_BEGIN || opt == DL_END)) {
@@ -3531,9 +3540,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
this->DebugCompileOptionsDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
- this->CompileOptionsEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, language, &dagChecker, this->CompileOptionsEntries);
AddInterfaceEntries(this, config, "INTERFACE_COMPILE_OPTIONS", language,
&dagChecker, entries);
@@ -3577,9 +3585,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
this->DebugCompileFeaturesDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, std::string(), &dagChecker,
- this->CompileFeaturesEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, std::string(), &dagChecker, this->CompileFeaturesEntries);
AddInterfaceEntries(this, config, "INTERFACE_COMPILE_FEATURES",
std::string(), &dagChecker, entries);
@@ -3625,9 +3632,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
this->DebugCompileDefinitionsDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
- this->CompileDefinitionsEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, language, &dagChecker, this->CompileDefinitionsEntries);
AddInterfaceEntries(this, config, "INTERFACE_COMPILE_DEFINITIONS", language,
&dagChecker, entries);
@@ -3647,7 +3653,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
case cmPolicies::OLD: {
std::unique_ptr<TargetPropertyEntry> entry =
CreateTargetPropertyEntry(*configProp);
- entries.emplace_back(EvaluateTargetPropertyEntry(
+ entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
this, config, language, &dagChecker, *entry));
} break;
case cmPolicies::NEW:
@@ -3687,9 +3693,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
this->DebugPrecompileHeadersDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
- this->PrecompileHeadersEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, language, &dagChecker, this->PrecompileHeadersEntries);
AddInterfaceEntries(this, config, "INTERFACE_PRECOMPILE_HEADERS", language,
&dagChecker, entries);
@@ -4064,9 +4069,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
this->DebugLinkOptionsDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
- this->LinkOptionsEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, language, &dagChecker, this->LinkOptionsEntries);
AddInterfaceEntries(this, config, "INTERFACE_LINK_OPTIONS", language,
&dagChecker, entries,
@@ -4205,14 +4209,14 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
cmGeneratorExpressionDAGChecker dagChecker(this, "STATIC_LIBRARY_OPTIONS",
nullptr, nullptr);
- std::vector<EvaluatedTargetPropertyEntry> entries;
+ EvaluatedTargetPropertyEntries entries;
if (cmProp linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) {
std::vector<std::string> options = cmExpandedList(*linkOptions);
for (const auto& option : options) {
std::unique_ptr<TargetPropertyEntry> entry =
CreateTargetPropertyEntry(option);
- entries.emplace_back(EvaluateTargetPropertyEntry(this, config, language,
- &dagChecker, *entry));
+ entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
+ this, config, language, &dagChecker, *entry));
}
}
processOptions(this, entries, result, uniqueOptions, false,
@@ -4223,12 +4227,12 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
namespace {
void processLinkDirectories(cmGeneratorTarget const* tgt,
- std::vector<EvaluatedTargetPropertyEntry>& entries,
+ EvaluatedTargetPropertyEntries& entries,
std::vector<BT<std::string>>& directories,
std::unordered_set<std::string>& uniqueDirectories,
bool debugDirectories)
{
- for (EvaluatedTargetPropertyEntry& entry : entries) {
+ for (EvaluatedTargetPropertyEntry& entry : entries.Entries) {
cmLinkImplItem const& item = entry.LinkImplItem;
std::string const& targetName = item.AsStr();
@@ -4327,9 +4331,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
this->DebugLinkDirectoriesDone = true;
}
- std::vector<EvaluatedTargetPropertyEntry> entries =
- EvaluateTargetPropertyEntries(this, config, language, &dagChecker,
- this->LinkDirectoriesEntries);
+ EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
+ this, config, language, &dagChecker, this->LinkDirectoriesEntries);
AddInterfaceEntries(this, config, "INTERFACE_LINK_DIRECTORIES", language,
&dagChecker, entries,
@@ -4360,14 +4363,14 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
cmGeneratorExpressionDAGChecker dagChecker(this, "LINK_DEPENDS", nullptr,
nullptr);
- std::vector<EvaluatedTargetPropertyEntry> entries;
+ EvaluatedTargetPropertyEntries entries;
if (cmProp linkDepends = this->GetProperty("LINK_DEPENDS")) {
std::vector<std::string> depends = cmExpandedList(*linkDepends);
for (const auto& depend : depends) {
std::unique_ptr<TargetPropertyEntry> entry =
CreateTargetPropertyEntry(depend);
- entries.emplace_back(EvaluateTargetPropertyEntry(this, config, language,
- &dagChecker, *entry));
+ entries.Entries.emplace_back(EvaluateTargetPropertyEntry(
+ this, config, language, &dagChecker, *entry));
}
}
AddInterfaceEntries(this, config, "INTERFACE_LINK_DEPENDS", language,
@@ -5885,6 +5888,7 @@ void cmGeneratorTarget::ExpandLinkItems(
std::string const& prop, std::string const& value, std::string const& config,
cmGeneratorTarget const* headTarget, bool usage_requirements_only,
std::vector<cmLinkItem>& items, bool& hadHeadSensitiveCondition,
+ bool& hadContextSensitiveCondition,
bool& hadLinkLanguageSensitiveCondition) const
{
// Keep this logic in sync with ComputeLinkImplementationLibraries.
@@ -5903,6 +5907,7 @@ void cmGeneratorTarget::ExpandLinkItems(
libs);
this->LookupLinkItems(libs, cge->GetBacktrace(), items);
hadHeadSensitiveCondition = cge->GetHadHeadSensitiveCondition();
+ hadContextSensitiveCondition = cge->GetHadContextSensitiveCondition();
hadLinkLanguageSensitiveCondition =
cge->GetHadLinkLanguageSensitiveCondition();
}
@@ -6407,6 +6412,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
this->ExpandLinkItems(linkIfaceProp, *explicitLibraries, config,
headTarget, usage_requirements_only, iface.Libraries,
iface.HadHeadSensitiveCondition,
+ iface.HadContextSensitiveCondition,
iface.HadLinkLanguageSensitiveCondition);
} else if (!cmp0022NEW)
// If CMP0022 is NEW then the plain tll signature sets the
@@ -6427,10 +6433,12 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
static const std::string newProp = "INTERFACE_LINK_LIBRARIES";
if (cmProp newExplicitLibraries = this->GetProperty(newProp)) {
bool hadHeadSensitiveConditionDummy = false;
+ bool hadContextSensitiveConditionDummy = false;
bool hadLinkLanguageSensitiveConditionDummy = false;
this->ExpandLinkItems(newProp, *newExplicitLibraries, config,
headTarget, usage_requirements_only, ifaceLibs,
hadHeadSensitiveConditionDummy,
+ hadContextSensitiveConditionDummy,
hadLinkLanguageSensitiveConditionDummy);
}
if (ifaceLibs != iface.Libraries) {
@@ -6498,6 +6506,7 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface(
this->ExpandLinkItems(info->LibrariesProp, info->Libraries, config,
headTarget, usage_requirements_only, iface.Libraries,
iface.HadHeadSensitiveCondition,
+ iface.HadContextSensitiveCondition,
iface.HadLinkLanguageSensitiveCondition);
std::vector<std::string> deps = cmExpandedList(info->SharedDeps);
this->LookupLinkItems(deps, cmListFileBacktrace(), iface.SharedDeps);
@@ -7020,6 +7029,9 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
if (cge->GetHadHeadSensitiveCondition()) {
impl.HadHeadSensitiveCondition = true;
}
+ if (cge->GetHadContextSensitiveCondition()) {
+ impl.HadContextSensitiveCondition = true;
+ }
if (cge->GetHadLinkLanguageSensitiveCondition()) {
impl.HadLinkLanguageSensitiveCondition = true;
}
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 2ef7b43..ff03914 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -989,6 +989,7 @@ private:
bool usage_requirements_only,
std::vector<cmLinkItem>& items,
bool& hadHeadSensitiveCondition,
+ bool& hadContextSensitiveCondition,
bool& hadLinkLanguageSensitiveCondition) const;
void LookupLinkItems(std::vector<std::string> const& names,
cmListFileBacktrace const& bt,
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index f27648c..3d92935 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -54,6 +54,9 @@ struct cmLinkImplementationLibraries
// Libraries linked directly in other configurations.
// Needed only for OLD behavior of CMP0003.
std::vector<cmLinkItem> WrongConfigLibraries;
+
+ // Whether the list depends on a genex referencing the configuration.
+ bool HadContextSensitiveCondition = false;
};
struct cmLinkInterfaceLibraries
@@ -63,6 +66,9 @@ struct cmLinkInterfaceLibraries
// Whether the list depends on a genex referencing the head target.
bool HadHeadSensitiveCondition = false;
+
+ // Whether the list depends on a genex referencing the configuration.
+ bool HadContextSensitiveCondition = false;
};
struct cmLinkInterface : public cmLinkInterfaceLibraries
diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx
index a2ed874..e45db36 100644
--- a/Source/kwsys/CommandLineArguments.cxx
+++ b/Source/kwsys/CommandLineArguments.cxx
@@ -20,9 +20,9 @@
#include <sstream>
#include <vector>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#ifdef _MSC_VER
# pragma warning(disable : 4786)
diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx
index 5cad934..c68c73c 100644
--- a/Source/kwsys/EncodingCXX.cxx
+++ b/Source/kwsys/EncodingCXX.cxx
@@ -17,8 +17,8 @@
# include "Encoding.hxx.in"
#endif
-#include <stdlib.h>
-#include <string.h>
+#include <cstdlib>
+#include <cstring>
#include <vector>
#ifdef _MSC_VER
diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx
index 8e30f92..fad6ee1 100644
--- a/Source/kwsys/Glob.cxx
+++ b/Source/kwsys/Glob.cxx
@@ -23,9 +23,9 @@
#include <string>
#include <vector>
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
+#include <cctype>
+#include <cstdio>
+#include <cstring>
namespace KWSYS_NAMESPACE {
#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
// On Windows and Apple, no difference between lower and upper case
diff --git a/Source/kwsys/RegularExpression.cxx b/Source/kwsys/RegularExpression.cxx
index 5e6f8da..4f74eba 100644
--- a/Source/kwsys/RegularExpression.cxx
+++ b/Source/kwsys/RegularExpression.cxx
@@ -28,8 +28,8 @@
# include "RegularExpression.hxx.in"
#endif
-#include <stdio.h>
-#include <string.h>
+#include <cstdio>
+#include <cstring>
namespace KWSYS_NAMESPACE {
@@ -367,8 +367,7 @@ bool RegularExpression::compile(const char* exp)
// Allocate space.
//#ifndef _WIN32
- if (this->program != nullptr)
- delete[] this->program;
+ delete[] this->program;
//#endif
this->program = new char[comp.regsize];
this->progsize = static_cast<int>(comp.regsize);
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index ba9fa67..c565823 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -64,9 +64,9 @@ typedef int siginfo_t;
#else
# include <sys/types.h>
-# include <errno.h> // extern int errno;
+# include <cerrno> // extern int errno;
+# include <csignal>
# include <fcntl.h>
-# include <signal.h>
# include <sys/resource.h> // getrlimit
# include <sys/time.h>
# include <sys/utsname.h> // int uname(struct utsname *buf);
@@ -163,11 +163,11 @@ typedef struct rlimit ResourceLimitType;
# undef KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP
#endif
-#include <ctype.h> // int isdigit(int c);
+#include <cctype> // int isdigit(int c);
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <memory.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#if defined(KWSYS_USE_LONG_LONG)
# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG)
@@ -1366,7 +1366,7 @@ std::string SymbolProperties::GetFileName(const std::string& path) const
{
std::string file(path);
if (!this->ReportPath) {
- size_t at = file.rfind("/");
+ size_t at = file.rfind('/');
if (at != std::string::npos) {
file.erase(0, at + 1);
}
@@ -3387,8 +3387,8 @@ std::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(
size_t pos = buffer.find(word, init);
if (pos != std::string::npos) {
this->CurrentPositionInFile = pos;
- pos = buffer.find(":", pos);
- size_t pos2 = buffer.find("\n", pos);
+ pos = buffer.find(':', pos);
+ size_t pos2 = buffer.find('\n', pos);
if (pos != std::string::npos && pos2 != std::string::npos) {
// It may happen that the beginning matches, but this is still not the
// requested key.
@@ -3937,7 +3937,7 @@ std::string SystemInformationImplementation::GetProgramStack(int firstFrame,
int wholePath)
{
std::ostringstream oss;
- std::string programStack = "";
+ std::string programStack;
#ifdef KWSYS_SYSTEMINFORMATION_HAS_DBGHELP
(void)wholePath;
@@ -4688,7 +4688,7 @@ std::string SystemInformationImplementation::ExtractValueFromSysCtl(
size_t pos = this->SysCtlBuffer.find(word);
if (pos != std::string::npos) {
pos = this->SysCtlBuffer.find(": ", pos);
- size_t pos2 = this->SysCtlBuffer.find("\n", pos);
+ size_t pos2 = this->SysCtlBuffer.find('\n', pos);
if (pos != std::string::npos && pos2 != std::string::npos) {
return this->SysCtlBuffer.substr(pos + 2, pos2 - pos - 2);
}
@@ -5500,13 +5500,13 @@ void SystemInformationImplementation::TrimNewline(std::string& output)
{
// remove \r
std::string::size_type pos = 0;
- while ((pos = output.find("\r", pos)) != std::string::npos) {
+ while ((pos = output.find('\r', pos)) != std::string::npos) {
output.erase(pos);
}
// remove \n
pos = 0;
- while ((pos = output.find("\n", pos)) != std::string::npos) {
+ while ((pos = output.find('\n', pos)) != std::string::npos) {
output.erase(pos);
}
}
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 3a6ceec..a6d210f 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -24,6 +24,7 @@
#include KWSYS_HEADER(Encoding.h)
#include KWSYS_HEADER(Encoding.hxx)
+#include <algorithm>
#include <fstream>
#include <iostream>
#include <set>
@@ -49,15 +50,15 @@
# pragma set woff 1375 /* base class destructor not virtual */
#endif
-#include <ctype.h>
-#include <errno.h>
+#include <cctype>
+#include <cerrno>
#ifdef __QNX__
# include <malloc.h> /* for malloc/free on QNX */
#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
#if defined(_WIN32) && !defined(_MSC_VER) && defined(__GNUC__)
# include <strings.h> /* for strcasecmp */
@@ -69,7 +70,7 @@
// support for realpath call
#ifndef _WIN32
-# include <limits.h>
+# include <climits>
# include <pwd.h>
# include <sys/ioctl.h>
# include <sys/time.h>
@@ -80,7 +81,7 @@
# include <sys/param.h>
# include <termios.h>
# endif
-# include <signal.h> /* sigprocmask */
+# include <csignal> /* sigprocmask */
#endif
#ifdef __linux
@@ -892,8 +893,12 @@ const char* SystemTools::GetExecutableExtension()
FILE* SystemTools::Fopen(const std::string& file, const char* mode)
{
#ifdef _WIN32
+ // Remove any 'e', which is supported on UNIX, but not Windows.
+ std::wstring trimmedMode = Encoding::ToWide(mode);
+ trimmedMode.erase(std::remove(trimmedMode.begin(), trimmedMode.end(), L'e'),
+ trimmedMode.end());
return _wfopen(Encoding::ToWindowsExtendedPath(file).c_str(),
- Encoding::ToWide(mode).c_str());
+ trimmedMode.c_str());
#else
return fopen(file.c_str(), mode);
#endif
@@ -2113,7 +2118,7 @@ std::string SystemTools::ConvertToUnixOutputPath(const std::string& path)
ret.erase(pos, 1);
}
// escape spaces and () in the path
- if (ret.find_first_of(" ") != std::string::npos) {
+ if (ret.find_first_of(' ') != std::string::npos) {
std::string result;
char lastch = 1;
for (const char* ch = ret.c_str(); *ch != '\0'; ++ch) {
@@ -2511,8 +2516,8 @@ bool SystemTools::CopyADirectory(const std::string& source,
return false;
}
for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) {
- if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), ".") &&
- strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), "..")) {
+ if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), ".") != 0 &&
+ strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), "..") != 0) {
std::string fullPath = source;
fullPath += "/";
fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
@@ -2674,8 +2679,8 @@ bool SystemTools::RemoveADirectory(const std::string& source)
dir.Load(source);
size_t fileNum;
for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) {
- if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), ".") &&
- strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), "..")) {
+ if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), ".") != 0 &&
+ strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)), "..") != 0) {
std::string fullPath = source;
fullPath += "/";
fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
@@ -3153,7 +3158,7 @@ bool SystemTools::SplitProgramPath(const std::string& in_name,
SystemTools::ConvertToUnixSlashes(dir);
if (!SystemTools::FileIsDirectory(dir)) {
- std::string::size_type slashPos = dir.rfind("/");
+ std::string::size_type slashPos = dir.rfind('/');
if (slashPos != std::string::npos) {
file = dir.substr(slashPos + 1);
dir.resize(slashPos);
@@ -3711,7 +3716,7 @@ std::string SystemTools::GetFilenamePath(const std::string& filename)
std::string fn = filename;
SystemTools::ConvertToUnixSlashes(fn);
- std::string::size_type slash_pos = fn.rfind("/");
+ std::string::size_type slash_pos = fn.rfind('/');
if (slash_pos == 0) {
return "/";
}
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index cd7b728..ae08e57 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -549,7 +549,8 @@ public:
*/
/**
- * Open a file considering unicode.
+ * Open a file considering unicode. On Windows, if 'e' is present in
+ * mode it is first discarded.
*/
static FILE* Fopen(const std::string& file, const char* mode);
diff --git a/Source/kwsys/testCommandLineArguments.cxx b/Source/kwsys/testCommandLineArguments.cxx
index 79ebe1a..0786751 100644
--- a/Source/kwsys/testCommandLineArguments.cxx
+++ b/Source/kwsys/testCommandLineArguments.cxx
@@ -12,8 +12,8 @@
#include <iostream>
#include <vector>
-#include <stddef.h> /* size_t */
-#include <string.h> /* strcmp */
+#include <cstddef> /* size_t */
+#include <cstring> /* strcmp */
static void* random_ptr = reinterpret_cast<void*>(0x123);
diff --git a/Source/kwsys/testCommandLineArguments1.cxx b/Source/kwsys/testCommandLineArguments1.cxx
index cbc3002..2f6b735 100644
--- a/Source/kwsys/testCommandLineArguments1.cxx
+++ b/Source/kwsys/testCommandLineArguments1.cxx
@@ -12,8 +12,8 @@
#include <iostream>
#include <vector>
-#include <assert.h> /* assert */
-#include <string.h> /* strcmp */
+#include <cassert> /* assert */
+#include <cstring> /* strcmp */
int testCommandLineArguments1(int argc, char* argv[])
{
@@ -51,9 +51,7 @@ int testCommandLineArguments1(int argc, char* argv[])
std::cout << "Value of N: " << n << std::endl;
std::cout << "Value of M: " << m << std::endl;
std::cout << "Value of P: " << p << std::endl;
- if (m) {
- delete[] m;
- }
+ delete[] m;
char** newArgv = nullptr;
int newArgc = 0;
diff --git a/Source/kwsys/testDynload.c b/Source/kwsys/testDynload.c
index c49f747..33a431e 100644
--- a/Source/kwsys/testDynload.c
+++ b/Source/kwsys/testDynload.c
@@ -8,6 +8,6 @@
DL_EXPORT int TestDynamicLoaderData = 0;
-DL_EXPORT void TestDynamicLoaderSymbolPointer()
+DL_EXPORT void TestDynamicLoaderSymbolPointer(void)
{
}
diff --git a/Source/kwsys/testEncoding.cxx b/Source/kwsys/testEncoding.cxx
index d672aed..ee93e8d 100644
--- a/Source/kwsys/testEncoding.cxx
+++ b/Source/kwsys/testEncoding.cxx
@@ -10,10 +10,10 @@
#include KWSYS_HEADER(Encoding.h)
#include <algorithm>
+#include <clocale>
+#include <cstdlib>
+#include <cstring>
#include <iostream>
-#include <locale.h>
-#include <stdlib.h>
-#include <string.h>
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
@@ -59,7 +59,7 @@ static int testHelloWorldEncoding()
std::string str2 = kwsys::Encoding::ToNarrow(wstr);
wchar_t* c_wstr = kwsysEncoding_DupToWide(str.c_str());
char* c_str2 = kwsysEncoding_DupToNarrow(c_wstr);
- if (!wstr.empty() && (str != str2 || strcmp(c_str2, str.c_str()))) {
+ if (!wstr.empty() && (str != str2 || strcmp(c_str2, str.c_str()) != 0)) {
std::cout << "converted string was different: " << str2 << std::endl;
std::cout << "converted string was different: " << c_str2 << std::endl;
ret++;
diff --git a/Source/kwsys/testFStream.cxx b/Source/kwsys/testFStream.cxx
index 5009e98..5762378 100644
--- a/Source/kwsys/testFStream.cxx
+++ b/Source/kwsys/testFStream.cxx
@@ -7,7 +7,7 @@
#endif
#include KWSYS_HEADER(FStream.hxx)
-#include <string.h>
+#include <cstring>
#ifdef __BORLANDC__
# include <mem.h> /* memcmp */
#endif
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 8909b49..ff8e2b2 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -20,10 +20,10 @@
// left on disk.
#include <testSystemTools.h>
+#include <cstdlib> /* free */
+#include <cstring> /* strcmp */
#include <iostream>
#include <sstream>
-#include <stdlib.h> /* free */
-#include <string.h> /* strcmp */
#if defined(_WIN32) && !defined(__CYGWIN__)
# include <io.h> /* _umask (MSVC) / umask (Borland) */
# ifdef _MSC_VER
@@ -507,7 +507,7 @@ static bool CheckStringOperations()
char* cres =
kwsys::SystemTools::AppendStrings("Mary Had A", " Little Lamb.");
- if (strcmp(cres, "Mary Had A Little Lamb.")) {
+ if (strcmp(cres, "Mary Had A Little Lamb.") != 0) {
std::cerr << "Problem with AppendStrings "
<< "\"Mary Had A\" \" Little Lamb.\"" << std::endl;
res = false;
@@ -515,7 +515,7 @@ static bool CheckStringOperations()
delete[] cres;
cres = kwsys::SystemTools::AppendStrings("Mary Had", " A ", "Little Lamb.");
- if (strcmp(cres, "Mary Had A Little Lamb.")) {
+ if (strcmp(cres, "Mary Had A Little Lamb.") != 0) {
std::cerr << "Problem with AppendStrings "
<< "\"Mary Had\" \" A \" \"Little Lamb.\"" << std::endl;
res = false;
@@ -529,7 +529,7 @@ static bool CheckStringOperations()
}
cres = kwsys::SystemTools::RemoveChars("Mary Had A Little Lamb.", "aeiou");
- if (strcmp(cres, "Mry Hd A Lttl Lmb.")) {
+ if (strcmp(cres, "Mry Hd A Lttl Lmb.") != 0) {
std::cerr << "Problem with RemoveChars "
<< "\"Mary Had A Little Lamb.\"" << std::endl;
res = false;
@@ -537,7 +537,7 @@ static bool CheckStringOperations()
delete[] cres;
cres = kwsys::SystemTools::RemoveCharsButUpperHex("Mary Had A Little Lamb.");
- if (strcmp(cres, "A")) {
+ if (strcmp(cres, "A") != 0) {
std::cerr << "Problem with RemoveCharsButUpperHex "
<< "\"Mary Had A Little Lamb.\"" << std::endl;
res = false;
@@ -546,7 +546,7 @@ static bool CheckStringOperations()
char* cres2 = strdup("Mary Had A Little Lamb.");
kwsys::SystemTools::ReplaceChars(cres2, "aeiou", 'X');
- if (strcmp(cres2, "MXry HXd A LXttlX LXmb.")) {
+ if (strcmp(cres2, "MXry HXd A LXttlX LXmb.") != 0) {
std::cerr << "Problem with ReplaceChars "
<< "\"Mary Had A Little Lamb.\"" << std::endl;
res = false;
@@ -568,7 +568,7 @@ static bool CheckStringOperations()
}
cres = kwsys::SystemTools::DuplicateString("Mary Had A Little Lamb.");
- if (strcmp(cres, "Mary Had A Little Lamb.")) {
+ if (strcmp(cres, "Mary Had A Little Lamb.") != 0) {
std::cerr << "Problem with DuplicateString "
<< "\"Mary Had A Little Lamb.\"" << std::endl;
res = false;
diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt
index f5dd276..21f923e 100644
--- a/Tests/ConfigSources/CMakeLists.txt
+++ b/Tests/ConfigSources/CMakeLists.txt
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 3.0)
project(ConfigSources CXX)
+# Per-config sources via INTERFACE_SOURCES.
add_library(iface INTERFACE)
target_sources(iface INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp"
@@ -12,10 +13,45 @@ target_compile_definitions(iface INTERFACE
"$<$<CONFIG:Debug>:CFG_DEBUG>"
"$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>"
)
-
add_executable(ConfigSources
$<$<CONFIG:Debug>:main_debug.cpp>
$<$<NOT:$<CONFIG:Debug>>:main_other.cpp>
$<$<CONFIG:NotAConfig>:does_not_exist.cpp>
)
target_link_libraries(ConfigSources iface)
+
+# Per-config sources via LINK_LIBRARIES.
+add_library(iface_debug INTERFACE)
+target_sources(iface_debug INTERFACE
+ "${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/iface_debug_src.cpp"
+ )
+add_library(iface_other INTERFACE)
+target_sources(iface_other INTERFACE
+ "${CMAKE_CURRENT_SOURCE_DIR}/iface_src.cpp"
+ "${CMAKE_CURRENT_SOURCE_DIR}/iface_other_src.cpp"
+ )
+add_executable(ConfigSourcesLink main.cpp)
+target_compile_definitions(ConfigSourcesLink PRIVATE
+ "$<$<CONFIG:Debug>:CFG_DEBUG>"
+ "$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>"
+ )
+target_link_libraries(ConfigSourcesLink PRIVATE
+ "$<$<CONFIG:Debug>:iface_debug>"
+ "$<$<NOT:$<CONFIG:Debug>>:iface_other>"
+ "$<$<CONFIG:NotAConfig>:iface_does_not_exist>"
+ )
+
+# Per-config sources via INTERFACE_LINK_LIBRARIES.
+add_library(ConfigSourcesIface INTERFACE)
+target_link_libraries(ConfigSourcesIface INTERFACE
+ "$<$<CONFIG:Debug>:iface_debug>"
+ "$<$<NOT:$<CONFIG:Debug>>:iface_other>"
+ "$<$<CONFIG:NotAConfig>:iface_does_not_exist>"
+ )
+add_executable(ConfigSourcesLinkIface main.cpp)
+target_compile_definitions(ConfigSourcesLinkIface PRIVATE
+ "$<$<CONFIG:Debug>:CFG_DEBUG>"
+ "$<$<NOT:$<CONFIG:Debug>>:CFG_OTHER>"
+ )
+target_link_libraries(ConfigSourcesLinkIface ConfigSourcesIface)
diff --git a/Tests/ConfigSources/main.cpp b/Tests/ConfigSources/main.cpp
new file mode 100644
index 0000000..c1cd3b2
--- /dev/null
+++ b/Tests/ConfigSources/main.cpp
@@ -0,0 +1,9 @@
+#if !defined(CFG_DEBUG) && !defined(CFG_OTHER)
+# error "Neither CFG_DEBUG or CFG_OTHER is defined."
+#endif
+#ifdef CFG_DEBUG
+# include "main_debug.cpp"
+#endif
+#ifdef CFG_OTHER
+# include "main_other.cpp"
+#endif
diff --git a/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt b/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt
new file mode 100644
index 0000000..57a0f6e
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.12)
+project(External NONE)
+
+if (DEFINED cache_arg)
+ message("configured with: ${cache_arg}")
+else ()
+ message("cache_arg is undefined")
+endif ()
+
+if (DEFINED second_cache_arg)
+ message("configured again with: ${second_cache_arg}")
+else ()
+ message("second_cache_arg is undefined")
+endif ()
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt
new file mode 100644
index 0000000..fea7fd9
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt
@@ -0,0 +1,2 @@
+.*configured with: first
+.*second_cache_arg is undefined
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt
new file mode 100644
index 0000000..e19e743
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt
@@ -0,0 +1,2 @@
+.*configured with: first
+.*configured again with: second
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake
new file mode 100644
index 0000000..fe69426
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake
@@ -0,0 +1,19 @@
+include("${CMAKE_CURRENT_BINARY_DIR}/data.cmake")
+
+include(ExternalProject)
+ExternalProject_add(external
+ SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/ExternalProject"
+ CMAKE_CACHE_ARGS
+ ${cache_args}
+ BUILD_COMMAND ""
+ INSTALL_COMMAND "")
+
+set(cache_args_path "<TMP_DIR>/external-cache-$<CONFIG>.cmake")
+set(cmake_cache_path "<BINARY_DIR>/CMakeCache.txt")
+_ep_replace_location_tags(external cache_args_path cmake_cache_path)
+
+file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake" CONTENT "
+set(check_pairs
+ \"${cmake_cache_path}|${cache_args_path}\"
+)
+")
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake
new file mode 100644
index 0000000..57c7ab7
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake
@@ -0,0 +1,3 @@
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/data.cmake"
+ "set(cache_args -Dcache_arg:STRING=first)
+")
diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake
new file mode 100644
index 0000000..cbb79e1
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake
@@ -0,0 +1,3 @@
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/data.cmake"
+ "set(cache_args -Dsecond_cache_arg:STRING=second)
+")
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
index 753417d..7a68c4b 100644
--- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
+++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
@@ -46,6 +46,11 @@ endif()
run_BuildDepends(Custom-Symbolic-and-Byproduct)
run_BuildDepends(Custom-Always)
+set(RunCMake_TEST_OUTPUT_MERGE_save "${RunCMake_TEST_OUTPUT_MERGE}")
+set(RunCMake_TEST_OUTPUT_MERGE 1)
+run_BuildDepends(ExternalProjectCacheArgs)
+set(RunCMake_TEST_OUTPUT_MERGE "${RunCMake_TEST_OUTPUT_MERGE_save}")
+
# Test header dependencies with a build tree underneath a source tree.
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/BuildUnderSource")
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/BuildUnderSource/build")
diff --git a/Tests/RunCMake/cmake_command/RunCMakeTest.cmake b/Tests/RunCMake/cmake_command/RunCMakeTest.cmake
index 2b6e7a2..0f12b80 100644
--- a/Tests/RunCMake/cmake_command/RunCMakeTest.cmake
+++ b/Tests/RunCMake/cmake_command/RunCMakeTest.cmake
@@ -5,6 +5,7 @@ run_cmake(cmake_command_unknown_meta_operation)
run_cmake(cmake_command_invoke_message)
run_cmake(cmake_command_invoke_message_fatal_error)
run_cmake(cmake_command_invoke_no_parameters)
+run_cmake(cmake_command_invoke_preserve_arguments)
run_cmake(cmake_command_invoke_unknown_function)
run_cmake(cmake_command_eval_message)
run_cmake(cmake_command_eval_message_fatal_error)
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments-stderr.txt b/Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments-stderr.txt
new file mode 100644
index 0000000..4670e60
--- /dev/null
+++ b/Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments-stderr.txt
@@ -0,0 +1,6 @@
+foo\(...\)
+\[a;b\]
+\[c;d\]
+cmake_command\(INVOKE foo ...\)
+\[a;b\]
+\[c;d\]
diff --git a/Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments.cmake b/Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments.cmake
new file mode 100644
index 0000000..53ac2e6
--- /dev/null
+++ b/Tests/RunCMake/cmake_command/cmake_command_invoke_preserve_arguments.cmake
@@ -0,0 +1,12 @@
+function(foo arg1 arg2)
+ math(EXPR last "${ARGC} - 1")
+ foreach(i RANGE 0 ${last})
+ message("[${ARGV${i}}]")
+ endforeach()
+endfunction()
+
+message("foo(...)")
+foo("a;b" "c;d")
+
+message("cmake_command(INVOKE foo ...)")
+cmake_command(INVOKE foo "a;b" "c;d")