summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx70
1 files changed, 42 insertions, 28 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 80986fc..ae1393f 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -12,6 +12,7 @@
#include <unordered_set>
#include <cm/memory>
+#include <cmext/algorithm>
#include "cmsys/RegularExpression.hxx"
@@ -176,6 +177,7 @@ public:
bool IsImportedTarget;
bool ImportedGloballyVisible;
bool BuildInterfaceIncludesAppended;
+ bool PerConfig;
std::set<BT<std::string>> Utilities;
std::vector<cmCustomCommand> PreBuildCommands;
std::vector<cmCustomCommand> PreLinkCommands;
@@ -213,7 +215,7 @@ public:
};
cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
- Visibility vis, cmMakefile* mf)
+ Visibility vis, cmMakefile* mf, bool perConfig)
: impl(cm::make_unique<cmTargetInternals>())
{
assert(mf);
@@ -229,6 +231,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
(vis == VisibilityImported || vis == VisibilityImportedGlobally);
impl->ImportedGloballyVisible = vis == VisibilityImportedGlobally;
impl->BuildInterfaceIncludesAppended = false;
+ impl->PerConfig = perConfig;
// Check whether this is a DLL platform.
impl->IsDLLPlatform =
@@ -357,7 +360,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("CUDA_RESOLVE_DEVICE_SYMBOLS");
initProp("LINK_SEARCH_START_STATIC");
initProp("LINK_SEARCH_END_STATIC");
- initProp("FOLDER");
initProp("Swift_LANGUAGE_VERSION");
initProp("Swift_MODULE_DIRECTORY");
initProp("VS_JUST_MY_CODE_DEBUGGING");
@@ -373,6 +375,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("XCODE_SCHEME_THREAD_SANITIZER_STOP");
initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER");
initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP");
+ initProp("XCODE_SCHEME_WORKING_DIRECTORY");
initProp("XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER");
initProp("XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP");
initProp("XCODE_SCHEME_MALLOC_SCRIBBLE");
@@ -382,11 +385,14 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
initProp("XCODE_SCHEME_MALLOC_STACK");
initProp("XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE");
initProp("XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS");
+ initProp("XCODE_SCHEME_ENVIRONMENT");
}
#endif
}
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
+ initProp("FOLDER");
+
if (this->GetGlobalGenerator()->IsXcode()) {
initProp("XCODE_GENERATE_SCHEME");
}
@@ -437,30 +443,30 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
if (!this->IsImported()) {
// Initialize the INCLUDE_DIRECTORIES property based on the current value
// of the same directory property:
- cmAppend(impl->IncludeDirectoriesEntries,
- impl->Makefile->GetIncludeDirectoriesEntries());
- cmAppend(impl->IncludeDirectoriesBacktraces,
- impl->Makefile->GetIncludeDirectoriesBacktraces());
+ cm::append(impl->IncludeDirectoriesEntries,
+ impl->Makefile->GetIncludeDirectoriesEntries());
+ cm::append(impl->IncludeDirectoriesBacktraces,
+ impl->Makefile->GetIncludeDirectoriesBacktraces());
{
auto const& sysInc = impl->Makefile->GetSystemIncludeDirectories();
impl->SystemIncludeDirectories.insert(sysInc.begin(), sysInc.end());
}
- cmAppend(impl->CompileOptionsEntries,
- impl->Makefile->GetCompileOptionsEntries());
- cmAppend(impl->CompileOptionsBacktraces,
- impl->Makefile->GetCompileOptionsBacktraces());
+ cm::append(impl->CompileOptionsEntries,
+ impl->Makefile->GetCompileOptionsEntries());
+ cm::append(impl->CompileOptionsBacktraces,
+ impl->Makefile->GetCompileOptionsBacktraces());
- cmAppend(impl->LinkOptionsEntries,
- impl->Makefile->GetLinkOptionsEntries());
- cmAppend(impl->LinkOptionsBacktraces,
- impl->Makefile->GetLinkOptionsBacktraces());
+ cm::append(impl->LinkOptionsEntries,
+ impl->Makefile->GetLinkOptionsEntries());
+ cm::append(impl->LinkOptionsBacktraces,
+ impl->Makefile->GetLinkOptionsBacktraces());
- cmAppend(impl->LinkDirectoriesEntries,
- impl->Makefile->GetLinkDirectoriesEntries());
- cmAppend(impl->LinkDirectoriesBacktraces,
- impl->Makefile->GetLinkDirectoriesBacktraces());
+ cm::append(impl->LinkDirectoriesEntries,
+ impl->Makefile->GetLinkDirectoriesEntries());
+ cm::append(impl->LinkDirectoriesBacktraces,
+ impl->Makefile->GetLinkDirectoriesBacktraces());
}
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
@@ -507,14 +513,14 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
this->GetType() != cmStateEnums::UTILITY) {
initProp("JOB_POOL_COMPILE");
initProp("JOB_POOL_LINK");
+ initProp("JOB_POOL_PRECOMPILE_HEADER");
}
if (impl->TargetType <= cmStateEnums::UTILITY) {
initProp("DOTNET_TARGET_FRAMEWORK_VERSION");
}
- if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
- this->GetType() != cmStateEnums::UTILITY) {
+ if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
// check for "CMAKE_VS_GLOBALS" variable and set up target properties
// if any
@@ -950,9 +956,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, std::string const& lib,
(isNonImportedTarget && llt != GENERAL_LibraryType)
? targetNameGenex(libRef)
: libRef;
- this->AppendProperty(
- "LINK_LIBRARIES",
- this->GetDebugGeneratorExpressions(libName, llt).c_str());
+ this->AppendProperty("LINK_LIBRARIES",
+ this->GetDebugGeneratorExpressions(libName, llt));
}
if (cmGeneratorExpression::Find(lib) != std::string::npos || lib != libRef ||
@@ -1286,9 +1291,9 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
impl->Properties.SetProperty(prop, reusedFrom.c_str());
- reusedTarget->SetProperty("COMPILE_PDB_NAME", reusedFrom.c_str());
+ reusedTarget->SetProperty("COMPILE_PDB_NAME", reusedFrom);
reusedTarget->SetProperty("COMPILE_PDB_OUTPUT_DIRECTORY",
- cmStrCat(reusedFrom, ".dir/").c_str());
+ cmStrCat(reusedFrom, ".dir/"));
this->SetProperty("COMPILE_PDB_NAME",
reusedTarget->GetProperty("COMPILE_PDB_NAME"));
@@ -1423,7 +1428,7 @@ void cmTarget::AppendBuildInterfaceIncludes()
dirs += impl->Makefile->GetCurrentSourceDirectory();
if (!dirs.empty()) {
this->AppendProperty("INTERFACE_INCLUDE_DIRECTORIES",
- ("$<BUILD_INTERFACE:" + dirs + ">").c_str());
+ ("$<BUILD_INTERFACE:" + dirs + ">"));
}
}
}
@@ -1558,8 +1563,12 @@ static void cmTargetCheckINTERFACE_LINK_LIBRARIES(const char* value,
static void cmTargetCheckIMPORTED_GLOBAL(const cmTarget* target,
cmMakefile* context)
{
- std::vector<cmTarget*> targets = context->GetOwnedImportedTargets();
- auto it = std::find(targets.begin(), targets.end(), target);
+ const auto& targets = context->GetOwnedImportedTargets();
+ auto it =
+ std::find_if(targets.begin(), targets.end(),
+ [&](const std::unique_ptr<cmTarget>& importTarget) -> bool {
+ return target == importTarget.get();
+ });
if (it == targets.end()) {
std::ostringstream e;
e << "Attempt to promote imported target \"" << target->GetName()
@@ -1801,6 +1810,11 @@ bool cmTarget::IsImportedGloballyVisible() const
return impl->ImportedGloballyVisible;
}
+bool cmTarget::IsPerConfig() const
+{
+ return impl->PerConfig;
+}
+
const char* cmTarget::GetSuffixVariableInternal(
cmStateEnums::ArtifactType artifact) const
{