Export: Process relative includes after genex evaluation.
In code such as install(TARGETS ... INCLUDES DESTINATION $<FOO>include ) the generator expressions are evaluated at generate-time. Delay determining whether each entry is a relative path until after the generator expressions are evaluated. Such relative paths are based relative to the CMAKE_INSTALL_PREFIX.
This commit is contained in:
parent
80790f3311
commit
9eedc850eb
|
@ -285,6 +285,27 @@ static bool checkInterfaceDirs(const std::string &prepro,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
static void prefixItems(std::string &exportDirs)
|
||||||
|
{
|
||||||
|
std::vector<std::string> entries;
|
||||||
|
cmGeneratorExpression::Split(exportDirs, entries);
|
||||||
|
exportDirs = "";
|
||||||
|
const char *sep = "";
|
||||||
|
for(std::vector<std::string>::const_iterator ei = entries.begin();
|
||||||
|
ei != entries.end(); ++ei)
|
||||||
|
{
|
||||||
|
exportDirs += sep;
|
||||||
|
sep = ";";
|
||||||
|
if (!cmSystemTools::FileIsFullPath(ei->c_str())
|
||||||
|
&& ei->find("${_IMPORT_PREFIX}") == std::string::npos)
|
||||||
|
{
|
||||||
|
exportDirs += "${_IMPORT_PREFIX}/";
|
||||||
|
}
|
||||||
|
exportDirs += *ei;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
|
void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
|
||||||
cmTargetExport *tei,
|
cmTargetExport *tei,
|
||||||
|
@ -330,6 +351,8 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prefixItems(exportDirs);
|
||||||
|
|
||||||
std::string includes = (input?input:"");
|
std::string includes = (input?input:"");
|
||||||
const char* sep = input ? ";" : "";
|
const char* sep = input ? ";" : "";
|
||||||
includes += sep + exportDirs;
|
includes += sep + exportDirs;
|
||||||
|
|
|
@ -228,11 +228,6 @@ void cmInstallCommandIncludesArgument::Parse(
|
||||||
for ( ; it != args->end(); ++it)
|
for ( ; it != args->end(); ++it)
|
||||||
{
|
{
|
||||||
std::string dir = *it;
|
std::string dir = *it;
|
||||||
if (!cmSystemTools::FileIsFullPath(it->c_str())
|
|
||||||
&& cmGeneratorExpression::Find(*it) == std::string::npos)
|
|
||||||
{
|
|
||||||
dir = "$<INSTALL_PREFIX>/" + dir;
|
|
||||||
}
|
|
||||||
cmSystemTools::ConvertToUnixSlashes(dir);
|
cmSystemTools::ConvertToUnixSlashes(dir);
|
||||||
this->IncludeDirs.push_back(dir);
|
this->IncludeDirs.push_back(dir);
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,7 +311,9 @@ install(TARGETS testLibRequired
|
||||||
INCLUDES DESTINATION
|
INCLUDES DESTINATION
|
||||||
installIncludesTest
|
installIncludesTest
|
||||||
$<INSTALL_PREFIX>/installIncludesTest2
|
$<INSTALL_PREFIX>/installIncludesTest2
|
||||||
)
|
installIncludesTest3/$<TARGET_PROPERTY:NAME>
|
||||||
|
$<TARGET_PROPERTY:NAME>/installIncludesTest4
|
||||||
|
)
|
||||||
install(TARGETS
|
install(TARGETS
|
||||||
testLibIncludeRequired1
|
testLibIncludeRequired1
|
||||||
testLibIncludeRequired2
|
testLibIncludeRequired2
|
||||||
|
@ -334,6 +336,10 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest.
|
||||||
|
|
||||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2")
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2")
|
||||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2/installIncludesTest2.h" "// No content\n")
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2/installIncludesTest2.h" "// No content\n")
|
||||||
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest3/testLibRequired")
|
||||||
|
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")
|
||||||
install(FILES
|
install(FILES
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest.h"
|
"${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest/installIncludesTest.h"
|
||||||
DESTINATION installIncludesTest
|
DESTINATION installIncludesTest
|
||||||
|
@ -342,6 +348,14 @@ install(FILES
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2/installIncludesTest2.h"
|
"${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest2/installIncludesTest2.h"
|
||||||
DESTINATION installIncludesTest2
|
DESTINATION installIncludesTest2
|
||||||
)
|
)
|
||||||
|
install(FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest3/testLibRequired/installIncludesTest3.h"
|
||||||
|
DESTINATION installIncludesTest3/testLibRequired
|
||||||
|
)
|
||||||
|
install(FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/testLibRequired/installIncludesTest4/installIncludesTest4.h"
|
||||||
|
DESTINATION testLibRequired/installIncludesTest4
|
||||||
|
)
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "installIncludesTest.h"
|
#include "installIncludesTest.h"
|
||||||
#include "installIncludesTest2.h"
|
#include "installIncludesTest2.h"
|
||||||
|
#include "installIncludesTest3.h"
|
||||||
|
#include "installIncludesTest4.h"
|
||||||
|
|
||||||
#ifndef testLibRequired_IFACE_DEFINE
|
#ifndef testLibRequired_IFACE_DEFINE
|
||||||
#error Expected testLibRequired_IFACE_DEFINE
|
#error Expected testLibRequired_IFACE_DEFINE
|
||||||
|
|
|
@ -48,3 +48,15 @@ install(TARGETS foo EXPORT FooTargets6
|
||||||
INCLUDES DESTINATION $<INSTALL_INTERFACE:include$<0:>>
|
INCLUDES DESTINATION $<INSTALL_INTERFACE:include$<0:>>
|
||||||
)
|
)
|
||||||
install(EXPORT FooTargets6 DESTINATION lib/cmake)
|
install(EXPORT FooTargets6 DESTINATION lib/cmake)
|
||||||
|
|
||||||
|
install(TARGETS foo EXPORT FooTargets7
|
||||||
|
DESTINATION lib
|
||||||
|
INCLUDES DESTINATION include$<0:>
|
||||||
|
)
|
||||||
|
install(EXPORT FooTargets7 DESTINATION lib/cmake)
|
||||||
|
|
||||||
|
install(TARGETS foo EXPORT FooTargets8
|
||||||
|
DESTINATION lib
|
||||||
|
INCLUDES DESTINATION $<0:>include
|
||||||
|
)
|
||||||
|
install(EXPORT FooTargets8 DESTINATION lib/cmake)
|
||||||
|
|
Loading…
Reference in New Issue