summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmMakefile.cxx17
-rw-r--r--Source/cmMakefile.h1
-rw-r--r--Tests/Complex/CMakeLists.txt2
-rw-r--r--Tests/Complex/Executable/complex.cxx17
-rw-r--r--Tests/Complex/cmTestConfigure.h.in2
-rw-r--r--Tests/ComplexOneConfig/CMakeLists.txt2
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx17
-rw-r--r--Tests/ComplexOneConfig/cmTestConfigure.h.in2
-rw-r--r--Tests/ComplexRelativePaths/CMakeLists.txt2
-rw-r--r--Tests/ComplexRelativePaths/Executable/complex.cxx17
-rw-r--r--Tests/ComplexRelativePaths/cmTestConfigure.h.in2
11 files changed, 77 insertions, 4 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index d47832e..2745905 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -74,7 +74,8 @@ cmMakefile::cmMakefile()
this->AddSourceGroup("Header Files", "\\.(h|h\\+\\+|hm|hpp|hxx|in|txx|inl)$");
this->AddSourceGroup("CMake Rules", "\\.rule$");
this->AddDefaultDefinitions();
- m_cmDefineRegex.compile("#cmakedefine[ \t]*([A-Za-z_0-9]*)");
+ m_cmDefineRegex.compile("#cmakedefine[ \t]+([A-Za-z_0-9]*)");
+ m_cmDefine01Regex.compile("#cmakedefine01[ \t]+([A-Za-z_0-9]*)");
this->PreOrder = false;
}
@@ -2399,6 +2400,20 @@ void cmMakefile::ConfigureString(const std::string& input,
output += " */";
}
}
+ else if(m_cmDefine01Regex.find(line))
+ {
+ const char* def = this->GetDefinition(m_cmDefine01Regex.match(1).c_str());
+ cmSystemTools::ReplaceString(line, "#cmakedefine01", "#define");
+ output += line;
+ if(!cmSystemTools::IsOff(def))
+ {
+ output += " 1";
+ }
+ else
+ {
+ output += " 0";
+ }
+ }
else
{
output += line;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index ab0c89a..dba2763 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -726,6 +726,7 @@ private:
DefinitionMap::key_type m_TemporaryDefinitionKey;
cmsys::RegularExpression m_cmDefineRegex;
+ cmsys::RegularExpression m_cmDefine01Regex;
std::map<cmStdString,cmStdString> m_Properties;
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index e8b1dd4..56784a0 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -243,6 +243,8 @@ WHILE (while_var LESS 1000)
SET(while_var ${while_var}0)
ENDWHILE(while_var LESS 1000)
+SET(SHOULD_BE_ZERO )
+SET(SHOULD_BE_ONE 1)
#
# Configure file
# (plug vars to #define so that they can be tested)
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 43eb109..c8b6f00 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -1114,7 +1114,22 @@ int main()
#else
cmFailed("Generated header included by non-generated source failed.");
#endif
-
+ if(SHOULD_BE_ZERO == 0)
+ {
+ cmPassed("cmakedefine01 is working for 0");
+ }
+ else
+ {
+ cmFailed("cmakedefine01 is not working for 0");
+ }
+ if(SHOULD_BE_ONE == 1)
+ {
+ cmPassed("cmakedefine01 is working for 1");
+ }
+ else
+ {
+ cmFailed("cmakedefine01 is not working for 1");
+ }
#ifdef FORCE_TEST
cmFailed("CMake SET CACHE FORCE");
#else
diff --git a/Tests/Complex/cmTestConfigure.h.in b/Tests/Complex/cmTestConfigure.h.in
index 9dbdd0b..eadd2f0 100644
--- a/Tests/Complex/cmTestConfigure.h.in
+++ b/Tests/Complex/cmTestConfigure.h.in
@@ -39,6 +39,8 @@
#cmakedefine CMAKE_NO_ANSI_STRING_STREAM
#cmakedefine CMAKE_NO_ANSI_FOR_SCOPE
+#cmakedefine01 SHOULD_BE_ZERO
+#cmakedefine01 SHOULD_BE_ONE
// Needed to check for files
#define BINARY_DIR "${Complex_BINARY_DIR}"
diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt
index e8b1dd4..56784a0 100644
--- a/Tests/ComplexOneConfig/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/CMakeLists.txt
@@ -243,6 +243,8 @@ WHILE (while_var LESS 1000)
SET(while_var ${while_var}0)
ENDWHILE(while_var LESS 1000)
+SET(SHOULD_BE_ZERO )
+SET(SHOULD_BE_ONE 1)
#
# Configure file
# (plug vars to #define so that they can be tested)
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index 43eb109..c8b6f00 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -1114,7 +1114,22 @@ int main()
#else
cmFailed("Generated header included by non-generated source failed.");
#endif
-
+ if(SHOULD_BE_ZERO == 0)
+ {
+ cmPassed("cmakedefine01 is working for 0");
+ }
+ else
+ {
+ cmFailed("cmakedefine01 is not working for 0");
+ }
+ if(SHOULD_BE_ONE == 1)
+ {
+ cmPassed("cmakedefine01 is working for 1");
+ }
+ else
+ {
+ cmFailed("cmakedefine01 is not working for 1");
+ }
#ifdef FORCE_TEST
cmFailed("CMake SET CACHE FORCE");
#else
diff --git a/Tests/ComplexOneConfig/cmTestConfigure.h.in b/Tests/ComplexOneConfig/cmTestConfigure.h.in
index 9dbdd0b..eadd2f0 100644
--- a/Tests/ComplexOneConfig/cmTestConfigure.h.in
+++ b/Tests/ComplexOneConfig/cmTestConfigure.h.in
@@ -39,6 +39,8 @@
#cmakedefine CMAKE_NO_ANSI_STRING_STREAM
#cmakedefine CMAKE_NO_ANSI_FOR_SCOPE
+#cmakedefine01 SHOULD_BE_ZERO
+#cmakedefine01 SHOULD_BE_ONE
// Needed to check for files
#define BINARY_DIR "${Complex_BINARY_DIR}"
diff --git a/Tests/ComplexRelativePaths/CMakeLists.txt b/Tests/ComplexRelativePaths/CMakeLists.txt
index e8b1dd4..56784a0 100644
--- a/Tests/ComplexRelativePaths/CMakeLists.txt
+++ b/Tests/ComplexRelativePaths/CMakeLists.txt
@@ -243,6 +243,8 @@ WHILE (while_var LESS 1000)
SET(while_var ${while_var}0)
ENDWHILE(while_var LESS 1000)
+SET(SHOULD_BE_ZERO )
+SET(SHOULD_BE_ONE 1)
#
# Configure file
# (plug vars to #define so that they can be tested)
diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx
index 43eb109..c8b6f00 100644
--- a/Tests/ComplexRelativePaths/Executable/complex.cxx
+++ b/Tests/ComplexRelativePaths/Executable/complex.cxx
@@ -1114,7 +1114,22 @@ int main()
#else
cmFailed("Generated header included by non-generated source failed.");
#endif
-
+ if(SHOULD_BE_ZERO == 0)
+ {
+ cmPassed("cmakedefine01 is working for 0");
+ }
+ else
+ {
+ cmFailed("cmakedefine01 is not working for 0");
+ }
+ if(SHOULD_BE_ONE == 1)
+ {
+ cmPassed("cmakedefine01 is working for 1");
+ }
+ else
+ {
+ cmFailed("cmakedefine01 is not working for 1");
+ }
#ifdef FORCE_TEST
cmFailed("CMake SET CACHE FORCE");
#else
diff --git a/Tests/ComplexRelativePaths/cmTestConfigure.h.in b/Tests/ComplexRelativePaths/cmTestConfigure.h.in
index 9dbdd0b..eadd2f0 100644
--- a/Tests/ComplexRelativePaths/cmTestConfigure.h.in
+++ b/Tests/ComplexRelativePaths/cmTestConfigure.h.in
@@ -39,6 +39,8 @@
#cmakedefine CMAKE_NO_ANSI_STRING_STREAM
#cmakedefine CMAKE_NO_ANSI_FOR_SCOPE
+#cmakedefine01 SHOULD_BE_ZERO
+#cmakedefine01 SHOULD_BE_ONE
// Needed to check for files
#define BINARY_DIR "${Complex_BINARY_DIR}"