summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-01-25 08:38:06 -0500
committerBill Hoffman <bill.hoffman@kitware.com>2006-01-25 08:38:06 -0500
commit07ef88c985a66cec5126930dbc3cfd736072183e (patch)
treecc9834e4f1f898845408fa21c006d4f9c391b318 /Source
parent008406a96c66afaa6a3e1105c730cffd1b1e8bc8 (diff)
downloadcmake-07ef88c985a66cec5126930dbc3cfd736072183e.tar.gz
ENH: add COMPILE_FLAGS to targets
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx10
-rw-r--r--Source/cmGlobalXCodeGenerator.h3
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx4
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx6
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx10
5 files changed, 27 insertions, 6 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 9a2af691e4..0879224cdd 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -466,12 +466,16 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateObjectReference(cmXCodeObject* ref)
//----------------------------------------------------------------------------
cmXCodeObject*
cmGlobalXCodeGenerator::CreateXCodeSourceFile(cmLocalGenerator* lg,
- cmSourceFile* sf)
+ cmSourceFile* sf,
+ cmTarget& cmtarget)
{
std::string flags;
// Add flags from source file properties.
+ if(cmtarget.GetProperty("COMPILE_FLAGS"))
+ {
+ lg->AppendFlags(flags, cmtarget.GetProperty("COMPILE_FLAGS"));
+ }
lg->AppendFlags(flags, sf->GetProperty("COMPILE_FLAGS"));
-
cmXCodeObject* fileRef = this->CreateObject(cmXCodeObject::PBXFileReference);
cmXCodeObject* group = m_GroupMap[sf];
@@ -650,7 +654,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
i != classes.end(); ++i)
{
cmXCodeObject* xsf =
- this->CreateXCodeSourceFile(m_CurrentLocalGenerator, *i);
+ this->CreateXCodeSourceFile(m_CurrentLocalGenerator, *i, cmtarget);
cmXCodeObject* fr = xsf->GetObject("fileRef");
cmXCodeObject* filetype =
fr->GetObject()->GetObject("lastKnownFileType");
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 9cea343c38..aafacc6a09 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -124,7 +124,8 @@ private:
cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen,
- cmSourceFile* sf);
+ cmSourceFile* sf,
+ cmTarget& cmtarget);
void CreateXCodeTargets(cmLocalGenerator* gen, std::vector<cmXCodeObject*>&);
void AddDependTarget(cmXCodeObject* target,
cmXCodeObject* dependTarget);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 8d4c46b106..5b15e968ac 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -617,6 +617,10 @@ cmLocalUnixMakefileGenerator3
// Write the build rule.
// Build the set of compiler flags.
std::string flags;
+ if(target.GetProperty("COMPILE_FLAGS"))
+ {
+ this->AppendFlags(flags, target.GetProperty("COMPILE_FLAGS"));
+ }
// Add flags from source file properties.
if (source.GetProperty("COMPILE_FLAGS"))
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 054a782035..54f83243e5 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -405,6 +405,12 @@ void cmLocalVisualStudio6Generator::WriteGroup(const cmSourceGroup *sg, cmTarget
{
compileFlags = cflags;
}
+ if(target.GetProperty("COMPILE_FLAGS"))
+ {
+ compileFlags += " ";
+ compileFlags += target.GetProperty("COMPILE_FLAGS");
+ }
+
const char* lang =
m_GlobalGenerator->GetLanguageFromExtension((*sf)->GetSourceExtension().c_str());
if(lang && strcmp(lang, "CXX") == 0)
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 85785883c3..466154dfbb 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1036,11 +1036,17 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget
std::string additionalDeps;
// Check for extra compiler flags.
+ if(target.GetProperty("COMPILE_FLAGS"))
+ {
+ compileFlags += " ";
+ compileFlags += target.GetProperty("COMPILE_FLAGS");
+ }
const char* cflags = (*sf)->GetProperty("COMPILE_FLAGS");
if(cflags)
{
- compileFlags = cflags;
- }
+ compileFlags += " ";
+ compileFlags += cflags;
+ }
const char* lang =
m_GlobalGenerator->GetLanguageFromExtension((*sf)->GetSourceExtension().c_str());
if(lang && strcmp(lang, "CXX") == 0)