ENH: Make per-configuration COMPILE_DEFINITIONS_<CONFIG> directory property initialized from parent.
This commit is contained in:
parent
8d1d5500c8
commit
9d57dbd098
|
@ -1134,9 +1134,30 @@ void cmMakefile::InitializeFromParent()
|
||||||
// define flags
|
// define flags
|
||||||
this->DefineFlags = parent->DefineFlags;
|
this->DefineFlags = parent->DefineFlags;
|
||||||
|
|
||||||
// compile definitions property
|
// compile definitions property and per-config versions
|
||||||
|
{
|
||||||
this->SetProperty("COMPILE_DEFINITIONS",
|
this->SetProperty("COMPILE_DEFINITIONS",
|
||||||
parent->GetProperty("COMPILE_DEFINITIONS"));
|
parent->GetProperty("COMPILE_DEFINITIONS"));
|
||||||
|
std::vector<std::string> configs;
|
||||||
|
if(const char* configTypes =
|
||||||
|
this->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
|
||||||
|
{
|
||||||
|
cmSystemTools::ExpandListArgument(configTypes, configs);
|
||||||
|
}
|
||||||
|
else if(const char* buildType =
|
||||||
|
this->GetDefinition("CMAKE_BUILD_TYPE"))
|
||||||
|
{
|
||||||
|
configs.push_back(buildType);
|
||||||
|
}
|
||||||
|
for(std::vector<std::string>::const_iterator ci = configs.begin();
|
||||||
|
ci != configs.end(); ++ci)
|
||||||
|
{
|
||||||
|
std::string defPropName = "COMPILE_DEFINITIONS_";
|
||||||
|
defPropName += cmSystemTools::UpperCase(*ci);
|
||||||
|
this->SetProperty(defPropName.c_str(),
|
||||||
|
parent->GetProperty(defPropName.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// link libraries
|
// link libraries
|
||||||
this->LinkLibraries = parent->LinkLibraries;
|
this->LinkLibraries = parent->LinkLibraries;
|
||||||
|
@ -3046,7 +3067,9 @@ void cmMakefile::DefineProperties(cmake *cm)
|
||||||
"language syntax may require escapes to specify some values). "
|
"language syntax may require escapes to specify some values). "
|
||||||
"This property may be set on a per-configuration basis using the name "
|
"This property may be set on a per-configuration basis using the name "
|
||||||
"COMPILE_DEFINITIONS_<CONFIG> where <CONFIG> is an upper-case name "
|
"COMPILE_DEFINITIONS_<CONFIG> where <CONFIG> is an upper-case name "
|
||||||
"(ex. \"COMPILE_DEFINITIONS_DEBUG\").\n"
|
"(ex. \"COMPILE_DEFINITIONS_DEBUG\"). "
|
||||||
|
"This property will be initialized in each directory by its value "
|
||||||
|
"in the directory's parent.\n"
|
||||||
"CMake will automatically drop some definitions that "
|
"CMake will automatically drop some definitions that "
|
||||||
"are not supported by the native build tool. "
|
"are not supported by the native build tool. "
|
||||||
"The VS6 IDE does not support definitions with values "
|
"The VS6 IDE does not support definitions with values "
|
||||||
|
@ -3063,7 +3086,9 @@ void cmMakefile::DefineProperties(cmake *cm)
|
||||||
cm->DefineProperty
|
cm->DefineProperty
|
||||||
("COMPILE_DEFINITIONS_<CONFIG>", cmProperty::DIRECTORY,
|
("COMPILE_DEFINITIONS_<CONFIG>", cmProperty::DIRECTORY,
|
||||||
"Per-configuration preprocessor definitions in a directory.",
|
"Per-configuration preprocessor definitions in a directory.",
|
||||||
"This is the configuration-specific version of COMPILE_DEFINITIONS.");
|
"This is the configuration-specific version of COMPILE_DEFINITIONS. "
|
||||||
|
"This property will be initialized in each directory by its value "
|
||||||
|
"in the directory's parent.\n");
|
||||||
|
|
||||||
cm->DefineProperty
|
cm->DefineProperty
|
||||||
("EXCLUDE_FROM_ALL", cmProperty::DIRECTORY,
|
("EXCLUDE_FROM_ALL", cmProperty::DIRECTORY,
|
||||||
|
|
|
@ -81,6 +81,10 @@ ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
||||||
ADD_DEFINITIONS(-DCMAKE_IS_REALLY_FUN)
|
ADD_DEFINITIONS(-DCMAKE_IS_REALLY_FUN)
|
||||||
|
SET_PROPERTY(DIRECTORY
|
||||||
|
PROPERTY COMPILE_DEFINITIONS_RELEASE
|
||||||
|
CMAKE_IS_FUN_IN_RELEASE_MODE
|
||||||
|
)
|
||||||
|
|
||||||
SET(TEST_SEP "a b c")
|
SET(TEST_SEP "a b c")
|
||||||
SEPARATE_ARGUMENTS(TEST_SEP)
|
SEPARATE_ARGUMENTS(TEST_SEP)
|
||||||
|
|
|
@ -61,7 +61,11 @@ void cmPassed(const char* Message, const char* m2="")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CMAKE_IS_REALLY_FUN
|
#ifndef CMAKE_IS_REALLY_FUN
|
||||||
This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
|
# error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE)
|
||||||
|
# error Per-configuration directory-level definition not inherited.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef COMPLEX_TEST_CMAKELIB
|
#ifdef COMPLEX_TEST_CMAKELIB
|
||||||
|
|
|
@ -81,6 +81,10 @@ ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
||||||
ADD_DEFINITIONS(-DCMAKE_IS_REALLY_FUN)
|
ADD_DEFINITIONS(-DCMAKE_IS_REALLY_FUN)
|
||||||
|
SET_PROPERTY(DIRECTORY
|
||||||
|
PROPERTY COMPILE_DEFINITIONS_RELEASE
|
||||||
|
CMAKE_IS_FUN_IN_RELEASE_MODE
|
||||||
|
)
|
||||||
|
|
||||||
SET(TEST_SEP "a b c")
|
SET(TEST_SEP "a b c")
|
||||||
SEPARATE_ARGUMENTS(TEST_SEP)
|
SEPARATE_ARGUMENTS(TEST_SEP)
|
||||||
|
|
|
@ -61,7 +61,11 @@ void cmPassed(const char* Message, const char* m2="")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CMAKE_IS_REALLY_FUN
|
#ifndef CMAKE_IS_REALLY_FUN
|
||||||
This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
|
# error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE)
|
||||||
|
# error Per-configuration directory-level definition not inherited.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef COMPLEX_TEST_CMAKELIB
|
#ifdef COMPLEX_TEST_CMAKELIB
|
||||||
|
|
|
@ -81,6 +81,10 @@ ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*")
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
ADD_DEFINITIONS(-DCMAKE_IS_FUN)
|
||||||
ADD_DEFINITIONS(-DCMAKE_IS_REALLY_FUN)
|
ADD_DEFINITIONS(-DCMAKE_IS_REALLY_FUN)
|
||||||
|
SET_PROPERTY(DIRECTORY
|
||||||
|
PROPERTY COMPILE_DEFINITIONS_RELEASE
|
||||||
|
CMAKE_IS_FUN_IN_RELEASE_MODE
|
||||||
|
)
|
||||||
|
|
||||||
SET(TEST_SEP "a b c")
|
SET(TEST_SEP "a b c")
|
||||||
SEPARATE_ARGUMENTS(TEST_SEP)
|
SEPARATE_ARGUMENTS(TEST_SEP)
|
||||||
|
|
|
@ -61,7 +61,11 @@ void cmPassed(const char* Message, const char* m2="")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CMAKE_IS_REALLY_FUN
|
#ifndef CMAKE_IS_REALLY_FUN
|
||||||
This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
|
# error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE)
|
||||||
|
# error Per-configuration directory-level definition not inherited.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef COMPLEX_TEST_CMAKELIB
|
#ifdef COMPLEX_TEST_CMAKELIB
|
||||||
|
|
Loading…
Reference in New Issue