diff options
author | Cristian Adam <cristian.adam@gmail.com> | 2019-12-11 11:45:16 (GMT) |
---|---|---|
committer | Cristian Adam <cristian.adam@gmail.com> | 2019-12-11 11:45:16 (GMT) |
commit | 372c89ea38dd56457f93c688f1e8bf30a25bad57 (patch) | |
tree | 9526f52a600c33f374f21e6a394ace06b57d4069 /Source | |
parent | 7a44e16d7f262475e32920ae1dedaf57a320db82 (diff) | |
download | CMake-372c89ea38dd56457f93c688f1e8bf30a25bad57.zip CMake-372c89ea38dd56457f93c688f1e8bf30a25bad57.tar.gz CMake-372c89ea38dd56457f93c688f1e8bf30a25bad57.tar.bz2 |
Refactor -arch and -isysroot code usage
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7451ff3..187e273 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1775,19 +1775,6 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, if (this->Makefile->IsOn("APPLE") && this->EmitUniversalBinaryFlags) { std::vector<std::string> archs; target->GetAppleArchs(config, archs); - const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); - if (sysroot && sysroot[0] == '/' && !sysroot[1]) { - sysroot = nullptr; - } - std::string sysrootFlagVar = - std::string("CMAKE_") + lang + "_SYSROOT_FLAG"; - const char* sysrootFlag = this->Makefile->GetDefinition(sysrootFlagVar); - const char* deploymentTarget = - this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); - std::string deploymentTargetFlagVar = - std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG"; - const char* deploymentTargetFlag = - this->Makefile->GetDefinition(deploymentTargetFlagVar); if (!archs.empty() && !lang.empty() && (lang[0] == 'C' || lang[0] == 'F' || lang[0] == 'O')) { for (std::string const& arch : archs) { @@ -1796,6 +1783,13 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, } } + const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); + if (sysroot && sysroot[0] == '/' && !sysroot[1]) { + sysroot = nullptr; + } + std::string sysrootFlagVar = + std::string("CMAKE_") + lang + "_SYSROOT_FLAG"; + const char* sysrootFlag = this->Makefile->GetDefinition(sysrootFlagVar); if (sysrootFlag && *sysrootFlag && sysroot && *sysroot) { flags += " "; flags += sysrootFlag; @@ -1803,6 +1797,13 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, flags += this->ConvertToOutputFormat(sysroot, SHELL); } + const char* deploymentTarget = + this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); + std::string deploymentTargetFlagVar = + std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG"; + const char* deploymentTargetFlag = + this->Makefile->GetDefinition(deploymentTargetFlagVar); + if (deploymentTargetFlag && *deploymentTargetFlag && deploymentTarget && *deploymentTarget) { flags += " "; |