summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-17 15:00:19 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-17 15:00:19 (GMT)
commit18b9e7db6c84bfe3936d33e7c7ca86a544f3e818 (patch)
treea24be738857d8de87efdba3ebae30a7795d54016 /Source/cmLocalGenerator.cxx
parent81af53e3c0b00005d2cf81a4a5482474573dd4b1 (diff)
downloadCMake-18b9e7db6c84bfe3936d33e7c7ca86a544f3e818.zip
CMake-18b9e7db6c84bfe3936d33e7c7ca86a544f3e818.tar.gz
CMake-18b9e7db6c84bfe3936d33e7c7ca86a544f3e818.tar.bz2
ENH: Enable CMAKE_<lang>_DEFINE_FLAG for COMPILE_DEFINITIONS property implementation.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx27
1 files changed, 19 insertions, 8 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 636ee8d..c788842 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1202,8 +1202,9 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
void cmLocalGenerator::FixDefineFlags(std::string& flags,
const char* lang)
{
- std::string defineFlagVar = "CMAKE_DEFINE_FLAG_";
+ std::string defineFlagVar = "CMAKE_";
defineFlagVar += lang;
+ defineFlagVar += "_DEFINE_FLAG";
std::string defineFlag =
this->Makefile->GetSafeDefinition(defineFlagVar.c_str());
if(defineFlag.size() == 0)
@@ -2219,7 +2220,8 @@ void cmLocalGenerator::AppendFlags(std::string& flags,
//----------------------------------------------------------------------------
void cmLocalGenerator::AppendDefines(std::string& defines,
- const char* defines_list)
+ const char* defines_list,
+ const char* lang)
{
// Short-circuit if there are no definitions.
if(!defines_list)
@@ -2237,14 +2239,22 @@ void cmLocalGenerator::AppendDefines(std::string& defines,
return;
}
- // Separate from previous definitions with a space.
- if(!defines.empty())
+ // Lookup the define flag for the current language.
+ std::string dflag = "-D";
+ if(lang)
{
- defines += " ";
+ std::string defineFlagVar = "CMAKE_";
+ defineFlagVar += lang;
+ defineFlagVar += "_DEFINE_FLAG";
+ const char* df = this->Makefile->GetDefinition(defineFlagVar.c_str());
+ if(df && *df)
+ {
+ dflag = df;
+ }
}
// Add each definition to the command line with appropriate escapes.
- const char* dsep = "-D";
+ const char* dsep = defines.empty()? "" : " ";
for(std::vector<std::string>::const_iterator di = defines_vec.begin();
di != defines_vec.end(); ++di)
{
@@ -2254,10 +2264,12 @@ void cmLocalGenerator::AppendDefines(std::string& defines,
continue;
}
- // Append the -D
+ // Separate from previous definitions.
defines += dsep;
+ dsep = " ";
// Append the definition with proper escaping.
+ defines += dflag;
if(this->WatcomWMake)
{
// The Watcom compiler does its own command line parsing instead
@@ -2284,7 +2296,6 @@ void cmLocalGenerator::AppendDefines(std::string& defines,
// Make the definition appear properly on the command line.
defines += this->EscapeForShell(di->c_str(), true);
}
- dsep = " -D";
}
}