Commit 76a19eb6 authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'fix-getsafedef-stdstring'

2428422c Fix regression in target output file naming logic
d686f81e Restore possibly regressed CMP0018 logic
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !2402
parents 3ada5134 2428422c
Pipeline #118288 passed with stage
in 0 seconds
......@@ -3494,13 +3494,12 @@ void cmGeneratorTarget::GetFullNameInternal(
}
// if there is no prefix on the target use the cmake definition
std::string targetPrefix2, targetSuffix2;
if (!targetPrefix && prefixVar) {
targetPrefix2 = this->Makefile->GetSafeDefinition(prefixVar);
targetPrefix = this->Makefile->GetSafeDefinition(prefixVar).c_str();
}
// if there is no suffix on the target use the cmake definition
if (!targetSuffix && suffixVar) {
targetSuffix2 = this->Makefile->GetSafeDefinition(suffixVar);
targetSuffix = this->Makefile->GetSafeDefinition(suffixVar).c_str();
}
// frameworks have directory prefix but no suffix
......@@ -3508,19 +3507,19 @@ void cmGeneratorTarget::GetFullNameInternal(
if (this->IsFrameworkOnApple()) {
fw_prefix = this->GetFrameworkDirectory(config, ContentLevel);
fw_prefix += "/";
targetPrefix2 = fw_prefix;
targetSuffix2.clear();
targetPrefix = fw_prefix.c_str();
targetSuffix = nullptr;
}
if (this->IsCFBundleOnApple()) {
fw_prefix = this->GetCFBundleDirectory(config, FullLevel);
fw_prefix += "/";
targetPrefix2 = fw_prefix;
targetSuffix2.clear();
targetPrefix = fw_prefix.c_str();
targetSuffix = nullptr;
}
// Begin the final name with the prefix.
outPrefix = targetPrefix2;
outPrefix = targetPrefix ? targetPrefix : "";
// Append the target name or property-specified name.
outBase += this->GetOutputName(config, artifact);
......@@ -3539,7 +3538,7 @@ void cmGeneratorTarget::GetFullNameInternal(
}
// Append the suffix.
outSuffix = targetSuffix2;
outSuffix = targetSuffix ? targetSuffix : "";
}
std::string cmGeneratorTarget::GetLinkerLanguage(
......
......@@ -828,11 +828,8 @@ void cmGlobalGenerator::EnableLanguage(
std::string sharedLibFlagsVar = "CMAKE_SHARED_LIBRARY_";
sharedLibFlagsVar += lang;
sharedLibFlagsVar += "_FLAGS";
std::string const& sharedLibFlags =
this->LanguageToOriginalSharedLibFlags[lang] =
mf->GetSafeDefinition(sharedLibFlagsVar);
if (!sharedLibFlags.empty()) {
this->LanguageToOriginalSharedLibFlags[lang] = sharedLibFlags;
}
// Translate compiler ids for compatibility.
this->CheckCompilerIdCompatibility(mf, lang);
......
......@@ -1826,7 +1826,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared,
flagsVar += "_FLAGS";
std::string const& flags = this->Makefile->GetSafeDefinition(flagsVar);
if (!flags.empty() && flags != originalFlags) {
if (flags != originalFlags) {
switch (this->GetPolicyStatus(cmPolicies::CMP0018)) {
case cmPolicies::WARN: {
std::ostringstream e;
......
......@@ -368,6 +368,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(CxxSubdirC CxxSubdirC)
ADD_TEST_MACRO(IPO COnly/COnly)
ADD_TEST_MACRO(OutDir runtime/OutDir)
ADD_TEST_MACRO(OutName exe.OutName.exe)
ADD_TEST_MACRO(ObjectLibrary UseCshared)
ADD_TEST_MACRO(NewlineArgs NewlineArgs)
ADD_TEST_MACRO(SetLang SetLang)
......
cmake_minimum_required(VERSION 3.12)
project(OutName C)
add_executable(OutName main.c)
set_property(TARGET OutName PROPERTY PREFIX exe.)
set_property(TARGET OutName PROPERTY SUFFIX .exe)
int main(void)
{
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment