Fix crash on export of target with empty INTERFACE_INCLUDE_DIRECTORIES.

The new feature of install(TARGETS ... INCLUDES DESTINATION) introduced
in commit 650e61f8 (Add a convenient way to add the includes install
dir to the INTERFACE., 2013-01-05) introduced this crash. If the
new feature is used with a target which has no
INTERFACE_INCLUDE_DIRECTORIES, a segfault occurred.
This commit is contained in:
Stephen Kelly 2013-07-27 11:14:56 +02:00
parent 46558d290b
commit f868e47236
3 changed files with 8 additions and 1 deletions

View File

@ -291,7 +291,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
{ {
return; return;
} }
if (!*input && tei->InterfaceIncludeDirectories.empty()) if ((input && !*input) && tei->InterfaceIncludeDirectories.empty())
{ {
// Set to empty // Set to empty
properties[propName] = ""; properties[propName] = "";

View File

@ -270,6 +270,8 @@ set_property(TARGET cmp0022NEW APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2
set_property(TARGET cmp0022OLD APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2) set_property(TARGET cmp0022OLD APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2)
set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3) set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3)
add_library(noIncludesInterface empty.cpp)
install(TARGETS testLibRequired install(TARGETS testLibRequired
testLibIncludeRequired1 testLibIncludeRequired1
testLibIncludeRequired2 testLibIncludeRequired2
@ -278,6 +280,7 @@ install(TARGETS testLibRequired
testLibIncludeRequired5 testLibIncludeRequired5
testLibIncludeRequired6 testLibIncludeRequired6
testSharedLibRequired testSharedLibRequired
noIncludesInterface
EXPORT RequiredExp DESTINATION lib EXPORT RequiredExp DESTINATION lib
INCLUDES DESTINATION INCLUDES DESTINATION
installIncludesTest installIncludesTest

View File

@ -0,0 +1,4 @@
#ifdef _WIN32
__declspec(dllexport)
#endif
int empty() { return 0; }