From f6b16d4b0642d26111cddff714b464e22b715482 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 29 Jan 2013 17:43:28 +0100 Subject: Don't allow targets args in the new target commands. --- Source/cmTargetCompileDefinitionsCommand.cxx | 10 ---------- Source/cmTargetCompileDefinitionsCommand.h | 5 ----- Source/cmTargetIncludeDirectoriesCommand.cxx | 20 -------------------- Source/cmTargetIncludeDirectoriesCommand.h | 5 ----- Source/cmTargetPropCommandBase.cxx | 22 +--------------------- Source/cmTargetPropCommandBase.h | 5 ----- .../target_compile_definitions/CMakeLists.txt | 2 +- .../target_include_directories/CMakeLists.txt | 2 +- Tests/ExportImport/Import/A/CMakeLists.txt | 19 +++++++++++++------ 9 files changed, 16 insertions(+), 74 deletions(-) diff --git a/Source/cmTargetCompileDefinitionsCommand.cxx b/Source/cmTargetCompileDefinitionsCommand.cxx index 683eff6..312d625 100644 --- a/Source/cmTargetCompileDefinitionsCommand.cxx +++ b/Source/cmTargetCompileDefinitionsCommand.cxx @@ -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) diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h index d49b9e8..6e8fc84 100644 --- a/Source/cmTargetCompileDefinitionsCommand.h +++ b/Source/cmTargetCompileDefinitionsCommand.h @@ -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); }; diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx index aeba468..51a2b6b 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.cxx +++ b/Source/cmTargetIncludeDirectoriesCommand.cxx @@ -41,26 +41,6 @@ void cmTargetIncludeDirectoriesCommand } //---------------------------------------------------------------------------- -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, bool prepend) diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h index 5a5f859..a254878 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.h +++ b/Source/cmTargetIncludeDirectoriesCommand.h @@ -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); }; diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index e1eb1d2..ef40438 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -66,14 +66,6 @@ bool cmTargetPropCommandBase } //---------------------------------------------------------------------------- -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 const& args, unsigned int &argIndex, bool prepend) @@ -108,19 +100,7 @@ bool cmTargetPropCommandBase this->PopulateTargetProperies(scope, content, prepend); return true; } - if (this->Makefile->FindTargetToUse(args[i].c_str())) - { - content += sep + "$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); diff --git a/Source/cmTargetPropCommandBase.h b/Source/cmTargetPropCommandBase.h index 0289c44..cc9897d 100644 --- a/Source/cmTargetPropCommandBase.h +++ b/Source/cmTargetPropCommandBase.h @@ -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; diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt index 3eca7fc..00cba44 100644 --- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt @@ -17,7 +17,7 @@ add_executable(consumer ) target_compile_definitions(consumer - PRIVATE target_compile_definitions importedlib + PRIVATE $ $<$:SHOULD_NOT_BE_DEFINED> $<$:SHOULD_BE_DEFINED> ) diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt index e190161..89b61f3 100644 --- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -43,5 +43,5 @@ add_executable(consumer ) target_include_directories(consumer - PRIVATE target_include_directories + PRIVATE $ ) diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 187c48a..e9bd2ba 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -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_compile_definitions(deps_iface PRIVATE $) 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_compile_definitions(deps_shared_iface PRIVATE - testSharedLibDepends + $ $<$>:PIC_PROPERTY_IS_ON> $<$>:CUSTOM_PROPERTY_IS_ON> $<$,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_compile_definitions(deps_shared_iface2 - PRIVATE bld_testSharedLibDepends TEST_SUBDIR_LIB + PRIVATE $ TEST_SUBDIR_LIB $<$>:PIC_PROPERTY_IS_ON> $<$>:CUSTOM_PROPERTY_IS_ON> $<$,testcontent>:CUSTOM_STRING_IS_MATCH> -- cgit v0.12