Make sure generator expressions can be used with target_include_directories.
Handle the case that a generator expression is used before treating a non-target as an error.
This commit is contained in:
parent
c2ab74acb9
commit
24dcf0c007
|
@ -65,6 +65,14 @@ bool cmTargetPropCommandBase
|
|||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static bool isGeneratorExpression(const std::string &lib)
|
||||
{
|
||||
const std::string::size_type openpos = lib.find("$<");
|
||||
return (openpos != std::string::npos)
|
||||
&& (lib.find(">", openpos) != std::string::npos);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmTargetPropCommandBase
|
||||
::ProcessContentArgs(std::vector<std::string> const& args,
|
||||
|
@ -105,6 +113,10 @@ bool cmTargetPropCommandBase
|
|||
content += sep + "$<TARGET_PROPERTY:" + args[i]
|
||||
+ ",INTERFACE_" + this->Property + ">";
|
||||
}
|
||||
else if(isGeneratorExpression(args[i]))
|
||||
{
|
||||
content += sep + args[i];
|
||||
}
|
||||
else if (!this->HandleNonTargetArg(content, sep, args[i], args[0]))
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -33,7 +33,12 @@ target_include_directories(target_include_directories
|
|||
PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/poison"
|
||||
)
|
||||
target_include_directories(target_include_directories
|
||||
BEFORE PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/cure"
|
||||
BEFORE PUBLIC "$<$<TARGET_DEFINED:target_include_directories>:${CMAKE_CURRENT_BINARY_DIR}/cure>"
|
||||
)
|
||||
|
||||
# Has no effect because the target is not defined:
|
||||
target_include_directories(target_include_directories
|
||||
BEFORE PUBLIC "$<$<TARGET_DEFINED:notdefined>:${CMAKE_CURRENT_BINARY_DIR}/poison>"
|
||||
)
|
||||
|
||||
add_library(importedlib UNKNOWN IMPORTED)
|
||||
|
|
Loading…
Reference in New Issue