diff options
author | Brad King <brad.king@kitware.com> | 2009-10-21 17:00:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-10-21 17:00:49 (GMT) |
commit | 2dc39b8c329425cb54e5e111e2b00d79caa1db36 (patch) | |
tree | 516539dab9c55976dbf95cdc6896abacaff4ae7a /Source/cmLocalGenerator.cxx | |
parent | 2f94a2c919ddb39f33c47b4baa7bd37e2ae4cacd (diff) | |
download | CMake-2dc39b8c329425cb54e5e111e2b00d79caa1db36.zip CMake-2dc39b8c329425cb54e5e111e2b00d79caa1db36.tar.gz CMake-2dc39b8c329425cb54e5e111e2b00d79caa1db36.tar.bz2 |
Define per-target OSX_ARCHITECTURES property
The CMAKE_OSX_ARCHITECTURES variable works only as a global setting.
This commit defines target properties
OSX_ARCHITECTURES
OSX_ARCHITECTURES_<CONFIG>
to specify OS X architectures on a per-target and per-configuration
basis. See issue #8725.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c4ee5c7..5c86992 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -712,6 +712,9 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) std::string langFlags; this->AddLanguageFlags(langFlags, llang, 0); +#ifdef __APPLE__ + this->AddArchitectureFlags(langFlags, &target, llang, 0); +#endif /* __APPLE__ */ vars.LanguageCompileFlags = langFlags.c_str(); cmCustomCommandLines commandLines; @@ -1751,21 +1754,18 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, } } + //---------------------------------------------------------------------------- -void cmLocalGenerator::AddLanguageFlags(std::string& flags, - const char* lang, - const char* config) -{ - // Add language-specific flags. - std::string flagsVar = "CMAKE_"; - flagsVar += lang; - flagsVar += "_FLAGS"; - // Add special OSX flags #ifdef __APPLE__ +void cmLocalGenerator::AddArchitectureFlags(std::string& flags, + cmTarget* target, + const char *lang, + const char* config) +{ if(this->EmitUniversalBinaryFlags) { - const char* osxArch = - this->Makefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); + std::vector<std::string> archs; + target->GetAppleArchs(config, archs); const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); const char* sysrootDefault = @@ -1775,24 +1775,13 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, std::string isysrootVar = std::string("CMAKE_") + lang + "_HAS_ISYSROOT"; bool hasIsysroot = this->Makefile->IsOn(isysrootVar.c_str()); bool flagsUsed = false; - if(osxArch && sysroot && lang && (lang[0] =='C' || lang[0] == 'F')) + if(!archs.empty() && sysroot && lang && (lang[0] =='C' || lang[0] == 'F')) { - std::vector<std::string> archs; - cmSystemTools::ExpandListArgument(std::string(osxArch), - archs); - bool addArchFlag = false; - if(archs.size() >= 1) - { - if(archs[0] != "") - { - addArchFlag = true; - } - } // if there is more than one arch add the -arch and // -isysroot flags, or if there is one arch flag, but // it is not the default -arch flag for the system, then // add it. Otherwize do not add -arch and -isysroot - if(addArchFlag) + if(archs[0] != "") { for( std::vector<std::string>::iterator i = archs.begin(); i != archs.end(); ++i) @@ -1823,7 +1812,19 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, flags += deploymentTarget; } } -#endif +} +#endif /* __APPLE__ */ + + +//---------------------------------------------------------------------------- +void cmLocalGenerator::AddLanguageFlags(std::string& flags, + const char* lang, + const char* config) +{ + // Add language-specific flags. + std::string flagsVar = "CMAKE_"; + flagsVar += lang; + flagsVar += "_FLAGS"; this->AddConfigVariableFlags(flags, flagsVar.c_str(), config); } |