diff options
author | Brad King <brad.king@kitware.com> | 2008-01-18 00:58:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-01-18 00:58:01 (GMT) |
commit | 8d1d5500c8cb7ebabce73777c79c33074e679ab5 (patch) | |
tree | 27c37321fe8aff93398c9309462eb4f05b735778 /Source/cmLocalUnixMakefileGenerator3.cxx | |
parent | 7f589c9f23ee64ca0d36e81a02a70a87bc7fbbbe (diff) | |
download | CMake-8d1d5500c8cb7ebabce73777c79c33074e679ab5.zip CMake-8d1d5500c8cb7ebabce73777c79c33074e679ab5.tar.gz CMake-8d1d5500c8cb7ebabce73777c79c33074e679ab5.tar.bz2 |
ENH: Enable use of COMPILE_DEFINITIONS property for Fortran sources.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index adabd0a..8445a6c 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1478,7 +1478,8 @@ cmLocalUnixMakefileGenerator3 else if(lang == "Fortran") { std::vector<std::string> defines; - if(const char* c_defines = mf->GetDefinition("CMAKE_DEFINITIONS")) + if(const char* c_defines = + mf->GetDefinition("CMAKE_TARGET_DEFINITIONS")) { cmSystemTools::ExpandListArgument(c_defines, defines); } @@ -1844,13 +1845,43 @@ void cmLocalUnixMakefileGenerator3 } } - cmakefileStream - << "\n" - << "# Preprocessor definitions for this directory.\n" - << "SET(CMAKE_DEFINITIONS\n" - << " " << this->Makefile->GetDefineFlags() << "\n" - << " )\n"; - + // Build a list of preprocessor definitions for the target. + std::vector<std::string> defines; + { + std::string defPropName = "COMPILE_DEFINITIONS_"; + defPropName += this->ConfigurationName; + if(const char* ddefs = this->Makefile->GetProperty("COMPILE_DEFINITIONS")) + { + cmSystemTools::ExpandListArgument(ddefs, defines); + } + if(const char* cdefs = target.GetProperty("COMPILE_DEFINITIONS")) + { + cmSystemTools::ExpandListArgument(cdefs, defines); + } + if(const char* dcdefs = this->Makefile->GetProperty(defPropName.c_str())) + { + cmSystemTools::ExpandListArgument(dcdefs, defines); + } + if(const char* ccdefs = target.GetProperty(defPropName.c_str())) + { + cmSystemTools::ExpandListArgument(ccdefs, defines); + } + } + if(!defines.empty()) + { + cmakefileStream + << "\n" + << "# Preprocessor definitions for this target.\n" + << "SET(CMAKE_TARGET_DEFINITIONS\n"; + for(std::vector<std::string>::const_iterator di = defines.begin(); + di != defines.end(); ++di) + { + cmakefileStream + << " " << this->EscapeForCMake(di->c_str()) << "\n"; + } + cmakefileStream + << " )\n"; + } } //---------------------------------------------------------------------------- |