Export: Process INSTALL_INTERFACE in INCLUDES DESTINATION.

Code such as

 install(TARGETS ...
   INCLUDES DESTINATION $<INSTALL_INTERFACE:include>
 )

should behave as if the INSTALL_INTERFACE wrapper were not present.
This commit is contained in:
Stephen Kelly 2013-11-26 10:39:23 +01:00
parent 9eedc850eb
commit f088a32450
3 changed files with 39 additions and 1 deletions

View File

@ -322,7 +322,10 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge(lfbt);
std::string dirs = tei->InterfaceIncludeDirectories; std::string dirs = cmGeneratorExpression::Preprocess(
tei->InterfaceIncludeDirectories,
preprocessRule,
true);
this->ReplaceInstallPrefix(dirs); this->ReplaceInstallPrefix(dirs);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
std::string exportDirs = cge->Evaluate(target->GetMakefile(), 0, std::string exportDirs = cge->Evaluate(target->GetMakefile(), 0,

View File

@ -313,6 +313,20 @@ install(TARGETS testLibRequired
$<INSTALL_PREFIX>/installIncludesTest2 $<INSTALL_PREFIX>/installIncludesTest2
installIncludesTest3/$<TARGET_PROPERTY:NAME> installIncludesTest3/$<TARGET_PROPERTY:NAME>
$<TARGET_PROPERTY:NAME>/installIncludesTest4 $<TARGET_PROPERTY:NAME>/installIncludesTest4
$<INSTALL_INTERFACE:installIncludesTest5$<0:>>
$<INSTALL_INTERFACE:$<0:>installIncludesTest6>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/installIncludesTest7>
)
target_include_directories(testLibRequired INTERFACE
# These can't be in the above install(INCLUDES DESTINATION call because
# that is only for installed interfaces. These directories are prefixes
# in the build dir, which is an error for the installed interface.
# We add them here so that we don't have to add conditions in the Import
# component of the test.
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest5$<0:>>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/$<0:>installIncludesTest6>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest7>
) )
install(TARGETS install(TARGETS
testLibIncludeRequired1 testLibIncludeRequired1
@ -340,6 +354,12 @@ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest3/testLibReq
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest3/testLibRequired/installIncludesTest3.h" "// No content\n") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest3/testLibRequired/installIncludesTest3.h" "// No content\n")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4/installIncludesTest4.h" "// No content\n") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4/installIncludesTest4.h" "// No content\n")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest5")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest5/installIncludesTest5.h" "// No content\n")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest6")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest6/installIncludesTest6.h" "// No content\n")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest7")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest7/installIncludesTest7.h" "// No content\n")
install(FILES install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest.h" "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest.h"
DESTINATION installIncludesTest DESTINATION installIncludesTest
@ -356,6 +376,18 @@ install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4/installIncludesTest4.h" "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4/installIncludesTest4.h"
DESTINATION testLibRequired/installIncludesTest4 DESTINATION testLibRequired/installIncludesTest4
) )
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest5/installIncludesTest5.h"
DESTINATION installIncludesTest5
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest6/installIncludesTest6.h"
DESTINATION installIncludesTest6
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest7/installIncludesTest7.h"
DESTINATION installIncludesTest7
)
install(TARGETS testLibDepends testSharedLibDepends EXPORT DependsExp DESTINATION lib ) install(TARGETS testLibDepends testSharedLibDepends EXPORT DependsExp DESTINATION lib )
install(EXPORT DependsExp FILE testLibDependsTargets.cmake DESTINATION lib/cmake/testLibDepends) install(EXPORT DependsExp FILE testLibDependsTargets.cmake DESTINATION lib/cmake/testLibDepends)

View File

@ -8,6 +8,9 @@
#include "installIncludesTest2.h" #include "installIncludesTest2.h"
#include "installIncludesTest3.h" #include "installIncludesTest3.h"
#include "installIncludesTest4.h" #include "installIncludesTest4.h"
#include "installIncludesTest5.h"
#include "installIncludesTest6.h"
#include "installIncludesTest7.h"
#ifndef testLibRequired_IFACE_DEFINE #ifndef testLibRequired_IFACE_DEFINE
#error Expected testLibRequired_IFACE_DEFINE #error Expected testLibRequired_IFACE_DEFINE