summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-07-10 14:20:26 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-07-10 14:21:00 (GMT)
commit9eaf0fea2824b2e0b767915dec25deed9552905a (patch)
tree12c8dd6941d4a22be7c5083f506dfdfa2c939152 /Source
parentfc58819150a126d87bf17ad812bb6f62f28ae42b (diff)
parent58f47448210bf3fd3121bf91f74eb893ba9d034c (diff)
downloadCMake-9eaf0fea2824b2e0b767915dec25deed9552905a.zip
CMake-9eaf0fea2824b2e0b767915dec25deed9552905a.tar.gz
CMake-9eaf0fea2824b2e0b767915dec25deed9552905a.tar.bz2
Merge topic 'indented_cmakedefine'
58f47448 configure_file: Add support for indented cmakedefine Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1024
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4a0cab3..195cd6b 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -66,8 +66,8 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
this->DefineFlags = " ";
- this->cmDefineRegex.compile("#cmakedefine[ \t]+([A-Za-z_0-9]*)");
- this->cmDefine01Regex.compile("#cmakedefine01[ \t]+([A-Za-z_0-9]*)");
+ this->cmDefineRegex.compile("#([ \t]*)cmakedefine[ \t]+([A-Za-z_0-9]*)");
+ this->cmDefine01Regex.compile("#([ \t]*)cmakedefine01[ \t]+([A-Za-z_0-9]*)");
this->cmAtVarRegex.compile("(@[A-Za-z_0-9/.+-]+@)");
this->cmNamedCurly.compile("^[A-Za-z0-9/_.+-]+{");
@@ -3433,18 +3433,22 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
// Replace #cmakedefine instances.
if (this->cmDefineRegex.find(line)) {
- const char* def = this->GetDefinition(this->cmDefineRegex.match(1));
+ const char* def = this->GetDefinition(this->cmDefineRegex.match(2));
if (!cmSystemTools::IsOff(def)) {
- cmSystemTools::ReplaceString(line, "#cmakedefine", "#define");
+ const std::string indentation = this->cmDefineRegex.match(1);
+ cmSystemTools::ReplaceString(line, "#" + indentation + "cmakedefine",
+ "#" + indentation + "define");
output += line;
} else {
output += "/* #undef ";
- output += this->cmDefineRegex.match(1);
+ output += this->cmDefineRegex.match(2);
output += " */";
}
} else if (this->cmDefine01Regex.find(line)) {
- const char* def = this->GetDefinition(this->cmDefine01Regex.match(1));
- cmSystemTools::ReplaceString(line, "#cmakedefine01", "#define");
+ const std::string indentation = this->cmDefine01Regex.match(1);
+ const char* def = this->GetDefinition(this->cmDefine01Regex.match(2));
+ cmSystemTools::ReplaceString(line, "#" + indentation + "cmakedefine01",
+ "#" + indentation + "define");
output += line;
if (!cmSystemTools::IsOff(def)) {
output += " 1";