From f088a3245001350f9c429e27bd12a3394742b0b8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 26 Nov 2013 10:39:23 +0100 Subject: Export: Process INSTALL_INTERFACE in INCLUDES DESTINATION. Code such as install(TARGETS ... INCLUDES DESTINATION $ ) should behave as if the INSTALL_INTERFACE wrapper were not present. --- Source/cmExportFileGenerator.cxx | 5 ++++- Tests/ExportImport/Export/CMakeLists.txt | 32 ++++++++++++++++++++++++++++++++ Tests/ExportImport/Import/A/deps_iface.c | 3 +++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 8f83c02..9186ab6 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -322,7 +322,10 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( cmListFileBacktrace lfbt; cmGeneratorExpression ge(lfbt); - std::string dirs = tei->InterfaceIncludeDirectories; + std::string dirs = cmGeneratorExpression::Preprocess( + tei->InterfaceIncludeDirectories, + preprocessRule, + true); this->ReplaceInstallPrefix(dirs); cmsys::auto_ptr cge = ge.Parse(dirs); std::string exportDirs = cge->Evaluate(target->GetMakefile(), 0, diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 6f48fcc..89c767f 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -313,6 +313,20 @@ install(TARGETS testLibRequired $/installIncludesTest2 installIncludesTest3/$ $/installIncludesTest4 + $> + $installIncludesTest6> + $/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. + $> + $installIncludesTest6> + $ ) install(TARGETS 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(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4") 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 "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest.h" DESTINATION installIncludesTest @@ -356,6 +376,18 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4/installIncludesTest4.h" 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(EXPORT DependsExp FILE testLibDependsTargets.cmake DESTINATION lib/cmake/testLibDepends) diff --git a/Tests/ExportImport/Import/A/deps_iface.c b/Tests/ExportImport/Import/A/deps_iface.c index bd9f75a..0dc8be2 100644 --- a/Tests/ExportImport/Import/A/deps_iface.c +++ b/Tests/ExportImport/Import/A/deps_iface.c @@ -8,6 +8,9 @@ #include "installIncludesTest2.h" #include "installIncludesTest3.h" #include "installIncludesTest4.h" +#include "installIncludesTest5.h" +#include "installIncludesTest6.h" +#include "installIncludesTest7.h" #ifndef testLibRequired_IFACE_DEFINE #error Expected testLibRequired_IFACE_DEFINE -- cgit v0.12