summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-12-14 14:02:54 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-12-14 14:03:08 (GMT)
commit84c2518a7bfa9a05f658c14bde0e9494508e30ed (patch)
tree1a84d4866c7464e79f5f0a15011bc469ad3f273e /Source/cmGlobalXCodeGenerator.cxx
parent15dcb41f202c2d2123ce47f7afb06e9adc735101 (diff)
parent7480fa0a5fd0ebc3fe06c702f3368e06a50c10ab (diff)
downloadCMake-84c2518a7bfa9a05f658c14bde0e9494508e30ed.zip
CMake-84c2518a7bfa9a05f658c14bde0e9494508e30ed.tar.gz
CMake-84c2518a7bfa9a05f658c14bde0e9494508e30ed.tar.bz2
Merge topic 'COMPILE_DEFINITIONS-property-cleanup'
7480fa0a5f COMPILE_DEFINITIONS property: ensure leading -D is removed in all cases Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !8004
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index a9a0fd5..f19dfd5 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -4995,7 +4995,13 @@ void cmGlobalXCodeGenerator::AppendDefines(
std::string def;
for (auto const& define : defines) {
// Start with -D if requested.
- def = cmStrCat(dflag ? "-D" : "", define);
+ if (dflag && !cmHasLiteralPrefix(define, "-D")) {
+ def = cmStrCat("-D", define);
+ } else if (!dflag && cmHasLiteralPrefix(define, "-D")) {
+ def = define.substr(2);
+ } else {
+ def = define;
+ }
// Append the flag with needed escapes.
std::string tmp;