OS X: Use -iframework for system framework directories
Just like -I flag has its -isystem counterpart which marks an include directory as a system directory and prevents unwanted warnings, on Apple systems there is -iframework -- a system directory replacement for -F. Use this flag to implement include_directories(SYSTEM) for frameworks.
This commit is contained in:
parent
1aed32faae
commit
1bed75a590
|
@ -24,4 +24,7 @@ macro(__darwin_compiler_clang lang)
|
||||||
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
|
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
|
||||||
set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot")
|
set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot")
|
||||||
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=")
|
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=")
|
||||||
|
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.1)
|
||||||
|
set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
|
@ -23,6 +23,10 @@ macro(__darwin_compiler_gnu lang)
|
||||||
# GNU does not have -shared on OS X
|
# GNU does not have -shared on OS X
|
||||||
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
|
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
|
||||||
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
|
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
|
||||||
|
|
||||||
|
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.3)
|
||||||
|
set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(cmake_gnu_set_sysroot_flag lang)
|
macro(cmake_gnu_set_sysroot_flag lang)
|
||||||
|
|
|
@ -1344,6 +1344,12 @@ std::string cmLocalGenerator::GetIncludeFlags(
|
||||||
const char* fwSearchFlag =
|
const char* fwSearchFlag =
|
||||||
this->Makefile->GetDefinition(fwSearchFlagVar);
|
this->Makefile->GetDefinition(fwSearchFlagVar);
|
||||||
|
|
||||||
|
std::string sysFwSearchFlagVar = "CMAKE_";
|
||||||
|
sysFwSearchFlagVar += lang;
|
||||||
|
sysFwSearchFlagVar += "_SYSTEM_FRAMEWORK_SEARCH_FLAG";
|
||||||
|
const char* sysFwSearchFlag =
|
||||||
|
this->Makefile->GetDefinition(sysFwSearchFlagVar);
|
||||||
|
|
||||||
bool flagUsed = false;
|
bool flagUsed = false;
|
||||||
std::set<std::string> emitted;
|
std::set<std::string> emitted;
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
@ -1360,9 +1366,17 @@ std::string cmLocalGenerator::GetIncludeFlags(
|
||||||
frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir.c_str());
|
frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir.c_str());
|
||||||
if(emitted.insert(frameworkDir).second)
|
if(emitted.insert(frameworkDir).second)
|
||||||
{
|
{
|
||||||
includeFlags
|
if (sysFwSearchFlag && target &&
|
||||||
<< fwSearchFlag << this->Convert(frameworkDir,
|
target->IsSystemIncludeDirectory(*i, config))
|
||||||
START_OUTPUT, shellFormat, true)
|
{
|
||||||
|
includeFlags << sysFwSearchFlag;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
includeFlags << fwSearchFlag;
|
||||||
|
}
|
||||||
|
includeFlags << this->Convert(frameworkDir, START_OUTPUT,
|
||||||
|
shellFormat, true)
|
||||||
<< " ";
|
<< " ";
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue