diff options
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 17 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/OutName/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/OutName/main.c | 4 |
4 files changed, 19 insertions, 9 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f563dd8..434e0a3 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3488,13 +3488,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 @@ -3502,19 +3501,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); @@ -3533,7 +3532,7 @@ void cmGeneratorTarget::GetFullNameInternal( } // Append the suffix. - outSuffix = targetSuffix2; + outSuffix = targetSuffix ? targetSuffix : ""; } std::string cmGeneratorTarget::GetLinkerLanguage( diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index a22521b..28aab1c 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -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) diff --git a/Tests/OutName/CMakeLists.txt b/Tests/OutName/CMakeLists.txt new file mode 100644 index 0000000..f024def --- /dev/null +++ b/Tests/OutName/CMakeLists.txt @@ -0,0 +1,6 @@ +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) diff --git a/Tests/OutName/main.c b/Tests/OutName/main.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/OutName/main.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} |