Don't allow targets args in the new target commands.

This commit is contained in:
Stephen Kelly 2013-01-29 17:43:28 +01:00
parent b3a7e19ee4
commit f6b16d4b06
9 changed files with 16 additions and 74 deletions

View File

@ -37,16 +37,6 @@ void cmTargetCompileDefinitionsCommand
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
}
bool cmTargetCompileDefinitionsCommand
::HandleNonTargetArg(std::string &content,
const std::string &sep,
const std::string &entry,
const std::string &)
{
content += sep + entry;
return true;
}
void cmTargetCompileDefinitionsCommand
::HandleDirectContent(cmTarget *tgt, const std::string &content,
bool)

View File

@ -81,11 +81,6 @@ private:
virtual void HandleImportedTarget(const std::string &tgt);
virtual void HandleMissingTarget(const std::string &name);
virtual bool HandleNonTargetArg(std::string &content,
const std::string &sep,
const std::string &entry,
const std::string &tgt);
virtual void HandleDirectContent(cmTarget *tgt, const std::string &content,
bool prepend);
};

View File

@ -40,26 +40,6 @@ void cmTargetIncludeDirectoriesCommand
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
}
//----------------------------------------------------------------------------
bool cmTargetIncludeDirectoriesCommand
::HandleNonTargetArg(std::string &content,
const std::string &sep,
const std::string &entry,
const std::string &tgt)
{
if (!cmSystemTools::FileIsFullPath(entry.c_str()))
{
cmOStringStream e;
e << "Cannot specify relative include directory \"" << entry << "\" for "
"target \"" << tgt << "\". Only absolute paths are permitted";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
content += sep + entry;
return true;
}
//----------------------------------------------------------------------------
void cmTargetIncludeDirectoriesCommand
::HandleDirectContent(cmTarget *tgt, const std::string &content,

View File

@ -85,11 +85,6 @@ private:
virtual void HandleImportedTarget(const std::string &tgt);
virtual void HandleMissingTarget(const std::string &name);
virtual bool HandleNonTargetArg(std::string &content,
const std::string &sep,
const std::string &entry,
const std::string &tgt);
virtual void HandleDirectContent(cmTarget *tgt, const std::string &content,
bool prepend);
};

View File

@ -65,14 +65,6 @@ 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,
@ -108,19 +100,7 @@ bool cmTargetPropCommandBase
this->PopulateTargetProperies(scope, content, prepend);
return true;
}
if (this->Makefile->FindTargetToUse(args[i].c_str()))
{
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;
}
content += sep + args[i];
sep = ";";
}
this->PopulateTargetProperies(scope, content, prepend);

View File

@ -38,11 +38,6 @@ private:
virtual void HandleImportedTarget(const std::string &tgt) = 0;
virtual void HandleMissingTarget(const std::string &name) = 0;
virtual bool HandleNonTargetArg(std::string &content,
const std::string &sep,
const std::string &entry,
const std::string &tgt) = 0;
virtual void HandleDirectContent(cmTarget *tgt,
const std::string &content,
bool prepend) = 0;

View File

@ -17,7 +17,7 @@ add_executable(consumer
)
target_compile_definitions(consumer
PRIVATE target_compile_definitions importedlib
PRIVATE $<TARGET_PROPERTY:target_compile_definitions,INTERFACE_COMPILE_DEFINITIONS>
$<$<TARGET_DEFINED:notdefined>:SHOULD_NOT_BE_DEFINED>
$<$<TARGET_DEFINED:target_compile_definitions>:SHOULD_BE_DEFINED>
)

View File

@ -43,5 +43,5 @@ add_executable(consumer
)
target_include_directories(consumer
PRIVATE target_include_directories
PRIVATE $<TARGET_PROPERTY:target_include_directories,INTERFACE_INCLUDE_DIRECTORIES>
)

View File

@ -159,15 +159,18 @@ endif()
add_executable(deps_iface deps_iface.c)
target_link_libraries(deps_iface testLibDepends)
target_include_directories(deps_iface PRIVATE testLibDepends)
target_compile_definitions(deps_iface PRIVATE testLibDepends)
target_include_directories(deps_iface PRIVATE $<TARGET_PROPERTY:testLibDepends,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_definitions(deps_iface PRIVATE $<TARGET_PROPERTY:testLibDepends,INTERFACE_COMPILE_DEFINITIONS>)
add_executable(deps_shared_iface deps_shared_iface.cpp)
target_link_libraries(deps_shared_iface testSharedLibDepends)
target_include_directories(deps_shared_iface PRIVATE testSharedLibDepends)
target_include_directories(deps_shared_iface
PRIVATE
$<TARGET_PROPERTY:testSharedLibDepends,INTERFACE_INCLUDE_DIRECTORIES>
)
target_compile_definitions(deps_shared_iface
PRIVATE
testSharedLibDepends
$<TARGET_PROPERTY:testSharedLibDepends,INTERFACE_COMPILE_DEFINITIONS>
$<$<BOOL:$<TARGET_PROPERTY:POSITION_INDEPENDENT_CODE>>:PIC_PROPERTY_IS_ON>
$<$<BOOL:$<TARGET_PROPERTY:CUSTOM_PROP>>:CUSTOM_PROPERTY_IS_ON>
$<$<STREQUAL:$<TARGET_PROPERTY:CUSTOM_STRING>,testcontent>:CUSTOM_STRING_IS_MATCH>
@ -197,9 +200,13 @@ endif()
add_executable(deps_shared_iface2 deps_shared_iface.cpp)
target_link_libraries(deps_shared_iface2 bld_testSharedLibDepends bld_subdirlib)
target_include_directories(deps_shared_iface2 PRIVATE bld_testSharedLibDepends bld_subdirlib)
target_include_directories(deps_shared_iface2
PRIVATE
$<TARGET_PROPERTY:bld_testSharedLibDepends,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:bld_subdirlib,INTERFACE_INCLUDE_DIRECTORIES>
)
target_compile_definitions(deps_shared_iface2
PRIVATE bld_testSharedLibDepends TEST_SUBDIR_LIB
PRIVATE $<TARGET_PROPERTY:bld_testSharedLibDepends,INTERFACE_COMPILE_DEFINITIONS> TEST_SUBDIR_LIB
$<$<BOOL:$<TARGET_PROPERTY:POSITION_INDEPENDENT_CODE>>:PIC_PROPERTY_IS_ON>
$<$<BOOL:$<TARGET_PROPERTY:CUSTOM_PROP>>:CUSTOM_PROPERTY_IS_ON>
$<$<STREQUAL:$<TARGET_PROPERTY:CUSTOM_STRING>,testcontent>:CUSTOM_STRING_IS_MATCH>