Merge topic 'INCLUDES-DESTINATION-no-config'
80e652f
Export: Process generator expressions from INCLUDES DESTINATION.4355815
cmTarget: Add NAME property
This commit is contained in:
commit
b341bf2178
|
@ -287,11 +287,33 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
|
|||
|
||||
const char *propName = "INTERFACE_INCLUDE_DIRECTORIES";
|
||||
const char *input = target->GetProperty(propName);
|
||||
if (!input && tei->InterfaceIncludeDirectories.empty())
|
||||
|
||||
cmListFileBacktrace lfbt;
|
||||
cmGeneratorExpression ge(lfbt);
|
||||
|
||||
std::string dirs = tei->InterfaceIncludeDirectories;
|
||||
this->ReplaceInstallPrefix(dirs);
|
||||
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
|
||||
std::string exportDirs = cge->Evaluate(target->GetMakefile(), 0,
|
||||
false, target);
|
||||
|
||||
if (cge->GetHadContextSensitiveCondition())
|
||||
{
|
||||
cmMakefile* mf = target->GetMakefile();
|
||||
cmOStringStream e;
|
||||
e << "Target \"" << target->GetName() << "\" is installed with "
|
||||
"INCLUDES DESTINATION set to a context sensitive path. Paths which "
|
||||
"depend on the configuration, policy values or the link interface are "
|
||||
"not supported. Consider using target_include_directories instead.";
|
||||
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!input && exportDirs.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ((input && !*input) && tei->InterfaceIncludeDirectories.empty())
|
||||
if ((input && !*input) && exportDirs.empty())
|
||||
{
|
||||
// Set to empty
|
||||
properties[propName] = "";
|
||||
|
@ -300,7 +322,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
|
|||
|
||||
std::string includes = (input?input:"");
|
||||
const char* sep = input ? ";" : "";
|
||||
includes += sep + tei->InterfaceIncludeDirectories;
|
||||
includes += sep + exportDirs;
|
||||
std::string prepro = cmGeneratorExpression::Preprocess(includes,
|
||||
preprocessRule,
|
||||
true);
|
||||
|
|
|
@ -944,6 +944,11 @@ void cmTarget::DefineProperties(cmake *cm)
|
|||
"This property is the configuration-specific version of "
|
||||
"OSX_ARCHITECTURES.");
|
||||
|
||||
cm->DefineProperty
|
||||
("NAME", cmProperty::TARGET,
|
||||
"Logical name for the target.",
|
||||
"Read-only logical name for the target as used by CMake.");
|
||||
|
||||
cm->DefineProperty
|
||||
("EXPORT_NAME", cmProperty::TARGET,
|
||||
"Exported name for target files.",
|
||||
|
@ -2971,7 +2976,13 @@ void cmTarget::SetProperty(const char* prop, const char* value)
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp(prop, "NAME") == 0)
|
||||
{
|
||||
cmOStringStream e;
|
||||
e << "NAME property is read-only\n";
|
||||
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
|
||||
return;
|
||||
}
|
||||
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
|
||||
{
|
||||
cmListFileBacktrace lfbt;
|
||||
|
@ -3038,6 +3049,13 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
|
|||
{
|
||||
return;
|
||||
}
|
||||
if (strcmp(prop, "NAME") == 0)
|
||||
{
|
||||
cmOStringStream e;
|
||||
e << "NAME property is read-only\n";
|
||||
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
|
||||
return;
|
||||
}
|
||||
if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0)
|
||||
{
|
||||
cmListFileBacktrace lfbt;
|
||||
|
@ -4053,6 +4071,11 @@ const char *cmTarget::GetProperty(const char* prop,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(prop, "NAME") == 0)
|
||||
{
|
||||
return this->GetName();
|
||||
}
|
||||
|
||||
// Watch for special "computed" properties that are dependent on
|
||||
// other properties or variables. Always recompute them.
|
||||
if(this->GetType() == cmTarget::EXECUTABLE ||
|
||||
|
|
|
@ -99,7 +99,6 @@ macro(add_include_lib _libName)
|
|||
set_property(TARGET ${_libName} APPEND PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/${_libName}>"
|
||||
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/${_libName}>"
|
||||
)
|
||||
if (NOT "${ARGV1}" STREQUAL "NO_HEADER")
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_libName}/${_libName}.h" "// no content\n")
|
||||
|
@ -188,8 +187,7 @@ install(FILES
|
|||
DESTINATION include/testSharedLibRequired
|
||||
)
|
||||
set_property(TARGET testSharedLibRequired APPEND PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/testSharedLibRequired>"
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}>"
|
||||
)
|
||||
set_property(TARGET testSharedLibRequired APPEND PROPERTY
|
||||
INTERFACE_COMPILE_DEFINITIONS USING_TESTSHAREDLIBREQUIRED
|
||||
|
@ -273,6 +271,12 @@ set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3
|
|||
add_library(noIncludesInterface empty.cpp)
|
||||
|
||||
install(TARGETS testLibRequired
|
||||
EXPORT RequiredExp DESTINATION lib
|
||||
INCLUDES DESTINATION
|
||||
installIncludesTest
|
||||
$<INSTALL_PREFIX>/installIncludesTest2
|
||||
)
|
||||
install(TARGETS
|
||||
testLibIncludeRequired1
|
||||
testLibIncludeRequired2
|
||||
testLibIncludeRequired3
|
||||
|
@ -283,8 +287,8 @@ install(TARGETS testLibRequired
|
|||
noIncludesInterface
|
||||
EXPORT RequiredExp DESTINATION lib
|
||||
INCLUDES DESTINATION
|
||||
installIncludesTest
|
||||
$<INSTALL_PREFIX>/installIncludesTest2)
|
||||
$<INSTALL_PREFIX>/include/$<TARGET_PROPERTY:NAME>
|
||||
)
|
||||
install(EXPORT RequiredExp NAMESPACE Req:: FILE testLibRequiredTargets.cmake DESTINATION lib/cmake/testLibRequired)
|
||||
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/installIncludesTest")
|
||||
|
|
|
@ -9,3 +9,4 @@ run_cmake(RelativePathInInterface)
|
|||
run_cmake(ImportedTarget)
|
||||
run_cmake(RelativePathInGenex)
|
||||
run_cmake(CMP0021)
|
||||
run_cmake(install_config)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
1
|
|
@ -0,0 +1,5 @@
|
|||
CMake Error in CMakeLists.txt:
|
||||
Target "foo" is installed with INCLUDES DESTINATION set to a context
|
||||
sensitive path. Paths which depend on the configuration, policy values or
|
||||
the link interface are not supported. Consider using
|
||||
target_include_directories instead.
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
enable_language(CXX)
|
||||
|
||||
add_executable(foo empty.cpp)
|
||||
install(TARGETS foo EXPORT fooTargets DESTINATION . INCLUDES DESTINATION include/$<CONFIGURATION>)
|
||||
install(EXPORT fooTargets DESTINATION lib/cmake)
|
Loading…
Reference in New Issue