Merge topic 'framework-interface-includes'

f5ca872 Use linked frameworks as a source of include directories.
This commit is contained in:
Brad King 2013-07-24 11:50:49 -04:00 committed by CMake Topic Stage
commit 828ddb6813
7 changed files with 60 additions and 0 deletions

View File

@ -3341,6 +3341,34 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
new cmTargetInternals::TargetPropertyEntry(cge, new cmTargetInternals::TargetPropertyEntry(cge,
it->Value)); it->Value));
} }
if(this->Makefile->IsOn("APPLE"))
{
LinkImplementation const* impl = this->GetLinkImplementation(config,
this);
for(std::vector<std::string>::const_iterator
it = impl->Libraries.begin();
it != impl->Libraries.end(); ++it)
{
std::string libDir = cmSystemTools::CollapseFullPath(it->c_str());
static cmsys::RegularExpression
frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$");
if(!frameworkCheck.find(libDir))
{
continue;
}
libDir = frameworkCheck.match(1);
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(libDir.c_str());
this->Internal
->CachedLinkInterfaceIncludeDirectoriesEntries[configString]
.push_back(new cmTargetInternals::TargetPropertyEntry(cge));
}
}
} }
processIncludeDirectories(this, processIncludeDirectories(this,

View File

@ -109,6 +109,11 @@ public:
" INTERFACE_POSITION_INDEPENDENT_CODE: Sets POSITION_INDEPENDENT_CODE\n" " INTERFACE_POSITION_INDEPENDENT_CODE: Sets POSITION_INDEPENDENT_CODE\n"
" or checked for consistency with existing value\n" " or checked for consistency with existing value\n"
"\n" "\n"
"If an <item> is a library in a Mac OX framework, the Headers "
"directory of the framework will also be processed as a \"usage "
"requirement\". This has the same effect as passing the framework "
"directory as an include directory."
"\n"
" target_link_libraries(<target> LINK_INTERFACE_LIBRARIES\n" " target_link_libraries(<target> LINK_INTERFACE_LIBRARIES\n"
" [[debug|optimized|general] <lib>] ...)\n" " [[debug|optimized|general] <lib>] ...)\n"
"The LINK_INTERFACE_LIBRARIES mode appends the libraries " "The LINK_INTERFACE_LIBRARIES mode appends the libraries "

View File

@ -312,6 +312,12 @@ install(
FRAMEWORK DESTINATION Frameworks FRAMEWORK DESTINATION Frameworks
BUNDLE DESTINATION Applications BUNDLE DESTINATION Applications
) )
if (APPLE)
file(COPY testLib4.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/testLib4.framework/Headers)
file(COPY testLib4.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug/testLib4.framework/Headers)
file(COPY testLib4.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Release/testLib4.framework/Headers)
install(FILES testLib4.h DESTINATION Frameworks/testLib4.framework/Headers)
endif()
install( install(
TARGETS TARGETS
testExe2libImp testLib3Imp testExe2libImp testLib3Imp

View File

@ -0,0 +1,2 @@
#define TESTLIB4_H

View File

@ -210,6 +210,10 @@ if (run_pic_test)
target_compile_definitions(deps_shared_iface PRIVATE CHECK_PIC_WORKS) target_compile_definitions(deps_shared_iface PRIVATE CHECK_PIC_WORKS)
endif() endif()
if(APPLE)
add_subdirectory(framework_interface)
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Test that targets imported from the build tree have their dependencies # Test that targets imported from the build tree have their dependencies
# evaluated correctly. The above already tests the same for the install tree. # evaluated correctly. The above already tests the same for the install tree.

View File

@ -0,0 +1,9 @@
add_library(exp_framework_test framework_test.cpp)
get_target_property(exp_loc exp_testLib4 LOCATION)
target_link_libraries(exp_framework_test ${exp_loc})
add_library(bld_framework_test framework_test.cpp)
get_target_property(bld_loc bld_testLib4 LOCATION)
target_link_libraries(bld_framework_test ${bld_loc})

View File

@ -0,0 +1,6 @@
#include <testLib4/testLib4.h>
#ifndef TESTLIB4_H
#error Expected define TESTLIB4_H
#endif