diff options
94 files changed, 572 insertions, 11 deletions
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 72de4ac..9e411a4 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -362,6 +362,18 @@ Variable Queries evaluation will give ``C`` as link language, so the second pass will correctly add target ``libother`` as link dependency. +``$<DEVICE_LINK:list>`` + Returns the list if it is the device link step, an empty list otherwise. + The device link step is controlled by :prop_tgt:`CUDA_SEPARABLE_COMPILATION` + and :prop_tgt:`CUDA_RESOLVE_DEVICE_SYMBOLS` properties. This expression can + only be used to specify link options. + +``$<HOST_LINK:list>`` + Returns the list if it is the normal link step, an empty list otherwise. + This expression is mainly useful when a device link step is also involved + (see ``$<DEVICE_LINK:list>`` generator expression). This expression can only + be used to specify link options. + String-Valued Generator Expressions =================================== diff --git a/Help/release/dev/genex-DEVICE_LINK-HOST_LINK.rst b/Help/release/dev/genex-DEVICE_LINK-HOST_LINK.rst new file mode 100644 index 0000000..ef275e7 --- /dev/null +++ b/Help/release/dev/genex-DEVICE_LINK-HOST_LINK.rst @@ -0,0 +1,6 @@ +genex-DEVICE_LINK-HOST_LINK +--------------------------- + +* To manage device and host link steps, the ``$<DEVICE_LINK:...>`` and + ``$<HOST_LINK:...>`` + :manual:`generator expressions <cmake-generator-expressions(7)>` were added. diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 2cc63c1..b4ba1a1 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -163,6 +163,13 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkExpression() const property == "LINK_DEPENDS"_s; } +bool cmGeneratorExpressionDAGChecker::EvaluatingLinkOptionsExpression() const +{ + cm::string_view property(this->Top()->Property); + + return property == "LINK_OPTIONS"_s; +} + bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries( cmGeneratorTarget const* tgt) const { diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index b58df03..c2c5b6b 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -69,6 +69,7 @@ struct cmGeneratorExpressionDAGChecker bool EvaluatingGenexExpression() const; bool EvaluatingPICExpression() const; bool EvaluatingLinkExpression() const; + bool EvaluatingLinkOptionsExpression() const; bool EvaluatingLinkLibraries(cmGeneratorTarget const* tgt = nullptr) const; diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 754a446..d48427e 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -15,6 +15,7 @@ #include <cm/iterator> #include <cm/string_view> +#include <cm/vector> #include <cmext/algorithm> #include "cmsys/RegularExpression.hxx" @@ -1187,6 +1188,70 @@ static const struct LinkLanguageAndIdNode : public cmGeneratorExpressionNode } } linkLanguageAndIdNode; +static const struct HostLinkNode : public cmGeneratorExpressionNode +{ + HostLinkNode() {} // NOLINT(modernize-use-equals-default) + + int NumExpectedParameters() const override { return ZeroOrMoreParameters; } + + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override + { + if (!context->HeadTarget || !dagChecker || + !dagChecker->EvaluatingLinkOptionsExpression()) { + reportError(context, content->GetOriginalExpression(), + "$<HOST_LINK:...> may only be used with binary targets " + "to specify link options."); + return std::string(); + } + + return context->HeadTarget->IsDeviceLink() ? std::string() + : cmJoin(parameters, ";"); + } +} hostLinkNode; + +static const struct DeviceLinkNode : public cmGeneratorExpressionNode +{ + DeviceLinkNode() {} // NOLINT(modernize-use-equals-default) + + int NumExpectedParameters() const override { return ZeroOrMoreParameters; } + + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override + { + if (!context->HeadTarget || !dagChecker || + !dagChecker->EvaluatingLinkOptionsExpression()) { + reportError(context, content->GetOriginalExpression(), + "$<DEVICE_LINK:...> may only be used with binary targets " + "to specify link options."); + return std::string(); + } + + if (context->HeadTarget->IsDeviceLink()) { + std::vector<std::string> list; + cmExpandLists(parameters.begin(), parameters.end(), list); + const auto DL_BEGIN = "<DEVICE_LINK>"_s; + const auto DL_END = "</DEVICE_LINK>"_s; + cm::erase_if(list, [&](const std::string& item) { + return item == DL_BEGIN || item == DL_END; + }); + + list.insert(list.begin(), static_cast<std::string>(DL_BEGIN)); + list.push_back(static_cast<std::string>(DL_END)); + + return cmJoin(list, ";"); + } + + return std::string(); + } +} deviceLinkNode; + std::string getLinkedTargetsContent( cmGeneratorTarget const* target, std::string const& prop, cmGeneratorExpressionContext* context, @@ -1304,6 +1369,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode context, content->GetOriginalExpression(), "$<TARGET_PROPERTY:prop> may only be used with binary targets. " "It may not be used with add_custom_command or add_custom_target. " + " " "Specify the target to read a property from using the " "$<TARGET_PROPERTY:tgt,prop> signature instead."); return std::string(); @@ -2464,6 +2530,8 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "COMPILE_LANGUAGE", &languageNode }, { "LINK_LANG_AND_ID", &linkLanguageAndIdNode }, { "LINK_LANGUAGE", &linkLanguageNode }, + { "HOST_LINK", &hostLinkNode }, + { "DEVICE_LINK", &deviceLinkNode }, { "SHELL_PATH", &shellPathNode } }; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index db25ddf..8a7f094 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5532,6 +5532,13 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt, return propContent; } +bool cmGeneratorTarget::SetDeviceLink(bool deviceLink) +{ + bool previous = this->DeviceLink; + this->DeviceLink = deviceLink; + return previous; +} + bool cmGeneratorTarget::GetLinkInterfaceDependentBoolProperty( const std::string& p, const std::string& config) const { @@ -5955,7 +5962,6 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries( } // Lookup any existing link interface for this configuration. - std::string CONFIG = cmSystemTools::UpperCase(config); cmHeadToLinkInterfaceMap& hm = (usage_requirements_only ? this->GetHeadToLinkInterfaceUsageRequirementsMap(config) @@ -6377,7 +6383,6 @@ const cmLinkInterface* cmGeneratorTarget::GetImportLinkInterface( return nullptr; } - std::string CONFIG = cmSystemTools::UpperCase(config); cmHeadToLinkInterfaceMap& hm = (usage_requirements_only ? this->GetHeadToLinkInterfaceUsageRequirementsMap(config) @@ -6591,16 +6596,15 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config, cmHeadToLinkInterfaceMap& cmGeneratorTarget::GetHeadToLinkInterfaceMap( const std::string& config) const { - std::string CONFIG = cmSystemTools::UpperCase(config); - return this->LinkInterfaceMap[CONFIG]; + return this->LinkInterfaceMap[cmSystemTools::UpperCase(config)]; } cmHeadToLinkInterfaceMap& cmGeneratorTarget::GetHeadToLinkInterfaceUsageRequirementsMap( const std::string& config) const { - std::string CONFIG = cmSystemTools::UpperCase(config); - return this->LinkInterfaceUsageRequirementsOnlyMap[CONFIG]; + return this + ->LinkInterfaceUsageRequirementsOnlyMap[cmSystemTools::UpperCase(config)]; } const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation( @@ -6617,8 +6621,8 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation( return nullptr; } - std::string CONFIG = cmSystemTools::UpperCase(config); - cmOptionalLinkImplementation& impl = this->LinkImplMap[CONFIG][this]; + cmOptionalLinkImplementation& impl = + this->LinkImplMap[cmSystemTools::UpperCase(config)][this]; if (secondPass) { impl = cmOptionalLinkImplementation(); } @@ -6877,8 +6881,8 @@ cmGeneratorTarget::GetLinkImplementationLibrariesInternal( } // Populate the link implementation libraries for this configuration. - std::string CONFIG = cmSystemTools::UpperCase(config); - HeadToLinkImplementationMap& hm = this->LinkImplMap[CONFIG]; + HeadToLinkImplementationMap& hm = + this->LinkImplMap[cmSystemTools::UpperCase(config)]; // If the link implementation does not depend on the head target // then return the one we computed first. diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 7cd253d..dd46bb9 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -204,6 +204,24 @@ public: const char* GetLinkInterfaceDependentNumberMaxProperty( const std::string& p, const std::string& config) const; + class DeviceLinkSetter + { + public: + DeviceLinkSetter(cmGeneratorTarget& target) + : Target(target) + { + this->PreviousState = target.SetDeviceLink(true); + } + ~DeviceLinkSetter() { this->Target.SetDeviceLink(this->PreviousState); }; + + private: + cmGeneratorTarget& Target; + bool PreviousState; + }; + + bool SetDeviceLink(bool deviceLink); + bool IsDeviceLink() const { return this->DeviceLink; } + cmLinkInterface const* GetLinkInterface( const std::string& config, const cmGeneratorTarget* headTarget) const; void ComputeLinkInterface(const std::string& config, @@ -829,6 +847,7 @@ private: mutable std::string LinkerLanguage; using LinkClosureMapType = std::map<std::string, LinkClosure>; mutable LinkClosureMapType LinkClosureMap; + bool DeviceLink = false; // Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type. const char* GetOutputTargetType(cmStateEnums::ArtifactType artifact) const; diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h index 0e405de..a5ecca7 100644 --- a/Source/cmStringAlgorithms.h +++ b/Source/cmStringAlgorithms.h @@ -87,7 +87,7 @@ void cmExpandLists(InputIt first, InputIt last, std::vector<std::string>& argsOut) { for (; first != last; ++first) { - ExpandList(*first, argsOut); + cmExpandList(*first, argsOut); } } diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command-stderr.txt new file mode 100644 index 0000000..eb15834 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-add_custom_command.cmake:[0-9]+ \(add_custom_command\): + Error evaluating generator expression: + + \$<DEVICE_LINK> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command.cmake new file mode 100644 index 0000000..01b3784 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_command.cmake @@ -0,0 +1,4 @@ +add_custom_target(drive) +add_custom_command(TARGET drive PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo $<DEVICE_LINK> +) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target-stderr.txt new file mode 100644 index 0000000..cdd3043 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-add_custom_target.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<DEVICE_LINK> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target.cmake new file mode 100644 index 0000000..35728e9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_custom_target.cmake @@ -0,0 +1,3 @@ +add_custom_target(drive + COMMAND ${CMAKE_COMMAND} -E echo $<DEVICE_LINK> +) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable-stderr.txt new file mode 100644 index 0000000..56b595c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-add_executable.cmake:[0-9]+ \(add_executable\): + Error evaluating generator expression: + + \$<DEVICE_LINK:empty.c> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable.cmake new file mode 100644 index 0000000..899f8f6 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_executable.cmake @@ -0,0 +1 @@ +add_executable(empty $<DEVICE_LINK:empty.c>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library-stderr.txt new file mode 100644 index 0000000..4477e00 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-add_library.cmake:[0-9]+ \(add_library\): + Error evaluating generator expression: + + \$<DEVICE_LINK:empty.c> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library.cmake new file mode 100644 index 0000000..fc8547b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_library.cmake @@ -0,0 +1 @@ +add_library(empty $<DEVICE_LINK:empty.c>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test-stderr.txt new file mode 100644 index 0000000..99561fe --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-add_test.cmake:[0-9]+ \(add_test\): + Error evaluating generator expression: + + \$<DEVICE_LINK> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test.cmake new file mode 100644 index 0000000..87d6ba1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-add_test.cmake @@ -0,0 +1,5 @@ + +include(CTest) +enable_testing() + +add_test(NAME dummy COMMAND ${CMAKE_COMMAND} -E echo $<DEVICE_LINK>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install-stderr.txt new file mode 100644 index 0000000..afb3090 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: + Error evaluating generator expression: + + \$<DEVICE_LINK:empty> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install.cmake new file mode 100644 index 0000000..4b6dbef --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-install.cmake @@ -0,0 +1,5 @@ + +install(FILES + $<DEVICE_LINK:empty> + DESTINATION src +) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends-stderr.txt new file mode 100644 index 0000000..4fa0522 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: + Error evaluating generator expression: + + \$<DEVICE_LINK:lib> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends.cmake new file mode 100644 index 0000000..8129514 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-link_depends.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(lib empty.c) + +add_executable(empty empty.c) +set_property(TARGET empty PROPERTY LINK_DEPENDS $<DEVICE_LINK:lib>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions-stderr.txt new file mode 100644 index 0000000..c0185e3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-target_compile_definitions.cmake:[0-9]+ \(target_compile_definitions\): + Error evaluating generator expression: + + \$<DEVICE_LINK:DEF> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions.cmake new file mode 100644 index 0000000..aaa8efc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_definitions.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_definitions(empty PRIVATE $<DEVICE_LINK:DEF>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options-stderr.txt new file mode 100644 index 0000000..34ca4f2 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-target_compile_options.cmake:[0-9]+ \(target_compile_options\): + Error evaluating generator expression: + + \$<DEVICE_LINK:-OPT> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options.cmake new file mode 100644 index 0000000..a9cb7fd --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_compile_options.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<DEVICE_LINK:-OPT>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories-stderr.txt new file mode 100644 index 0000000..4d1642d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-target_include_directories.cmake:[0-9]+ \(target_include_directories\): + Error evaluating generator expression: + + \$<DEVICE_LINK:/DIR> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories.cmake new file mode 100644 index 0000000..03cc413 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_include_directories.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_include_directories(empty PRIVATE $<DEVICE_LINK:/DIR>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories-stderr.txt new file mode 100644 index 0000000..d924916 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-target_link_directories.cmake:[0-9]+ \(target_link_directories\): + Error evaluating generator expression: + + \$<DEVICE_LINK:/DIR> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories.cmake new file mode 100644 index 0000000..e50d27d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_directories.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(lib empty.c) + +add_executable(empty empty.c) +target_link_directories(empty PRIVATE $<DEVICE_LINK:/DIR>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries-stderr.txt new file mode 100644 index 0000000..1436fa8 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-target_link_libraries.cmake:[0-9]+ \(target_link_libraries\): + Error evaluating generator expression: + + \$<DEVICE_LINK:lib> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries.cmake new file mode 100644 index 0000000..971f562 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_link_libraries.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(lib empty.c) + +add_executable(empty empty.c) +target_link_libraries(empty PRIVATE $<DEVICE_LINK:lib>) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources-result.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources-stderr.txt new file mode 100644 index 0000000..c9b602d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at DEVICE_LINK-target_sources.cmake:[0-9]+ \(target_sources\): + Error evaluating generator expression: + + \$<DEVICE_LINK:empty.c> + + \$<DEVICE_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources.cmake new file mode 100644 index 0000000..94bac9e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/DEVICE_LINK-target_sources.cmake @@ -0,0 +1,2 @@ +add_library(empty) +target_sources(empty PRIVATE $<DEVICE_LINK:empty.c>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command-stderr.txt new file mode 100644 index 0000000..5ad41b9 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-add_custom_command.cmake:[0-9]+ \(add_custom_command\): + Error evaluating generator expression: + + \$<HOST_LINK> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command.cmake new file mode 100644 index 0000000..4d6e305 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_command.cmake @@ -0,0 +1,4 @@ +add_custom_target(drive) +add_custom_command(TARGET drive PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E echo $<HOST_LINK> +) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target-stderr.txt new file mode 100644 index 0000000..c44202a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-add_custom_target.cmake:[0-9]+ \(add_custom_target\): + Error evaluating generator expression: + + \$<HOST_LINK> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target.cmake new file mode 100644 index 0000000..eec072a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_custom_target.cmake @@ -0,0 +1,3 @@ +add_custom_target(drive + COMMAND ${CMAKE_COMMAND} -E echo $<HOST_LINK> +) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable-stderr.txt new file mode 100644 index 0000000..b395515 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-add_executable.cmake:[0-9]+ \(add_executable\): + Error evaluating generator expression: + + \$<HOST_LINK:empty.c> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable.cmake new file mode 100644 index 0000000..c9f74a5 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_executable.cmake @@ -0,0 +1 @@ +add_executable(empty $<HOST_LINK:empty.c>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library-stderr.txt new file mode 100644 index 0000000..4bd27be --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-add_library.cmake:[0-9]+ \(add_library\): + Error evaluating generator expression: + + \$<HOST_LINK:empty.c> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library.cmake new file mode 100644 index 0000000..44135af --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_library.cmake @@ -0,0 +1 @@ +add_library(empty $<HOST_LINK:empty.c>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test-stderr.txt new file mode 100644 index 0000000..012ad21 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-add_test.cmake:[0-9]+ \(add_test\): + Error evaluating generator expression: + + \$<HOST_LINK> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test.cmake new file mode 100644 index 0000000..4b472af --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-add_test.cmake @@ -0,0 +1,5 @@ + +include(CTest) +enable_testing() + +add_test(NAME dummy COMMAND ${CMAKE_COMMAND} -E echo $<HOST_LINK>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-install-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-install-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-install-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-install-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-install-stderr.txt new file mode 100644 index 0000000..c265ec4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-install-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: + Error evaluating generator expression: + + \$<HOST_LINK:empty> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-install.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-install.cmake new file mode 100644 index 0000000..b4dff68 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-install.cmake @@ -0,0 +1,5 @@ + +install(FILES + $<HOST_LINK:empty> + DESTINATION src +) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends-stderr.txt new file mode 100644 index 0000000..24b8b82 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: + Error evaluating generator expression: + + \$<HOST_LINK:lib> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends.cmake new file mode 100644 index 0000000..0402f43 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-link_depends.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(lib empty.c) + +add_executable(empty empty.c) +set_property(TARGET empty PROPERTY LINK_DEPENDS $<HOST_LINK:lib>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions-stderr.txt new file mode 100644 index 0000000..6ab3c14 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-target_compile_definitions.cmake:[0-9]+ \(target_compile_definitions\): + Error evaluating generator expression: + + \$<HOST_LINK:DEF> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions.cmake new file mode 100644 index 0000000..f6c130d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_definitions.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_definitions(empty PRIVATE $<HOST_LINK:DEF>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options-stderr.txt new file mode 100644 index 0000000..0f5bbc3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-target_compile_options.cmake:[0-9]+ \(target_compile_options\): + Error evaluating generator expression: + + \$<HOST_LINK:-OPT> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options.cmake new file mode 100644 index 0000000..53afea1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_compile_options.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_compile_options(empty PRIVATE $<HOST_LINK:-OPT>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories-stderr.txt new file mode 100644 index 0000000..9a2634a --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-target_include_directories.cmake:[0-9]+ \(target_include_directories\): + Error evaluating generator expression: + + \$<HOST_LINK:/DIR> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories.cmake new file mode 100644 index 0000000..aff1009 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_include_directories.cmake @@ -0,0 +1,4 @@ + +enable_language(C) +add_executable(empty empty.c) +target_include_directories(empty PRIVATE $<HOST_LINK:/DIR>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories-stderr.txt new file mode 100644 index 0000000..5225a52 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-target_link_directories.cmake:[0-9]+ \(target_link_directories\): + Error evaluating generator expression: + + \$<HOST_LINK:/DIR> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories.cmake new file mode 100644 index 0000000..97488ee --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_directories.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(lib empty.c) + +add_executable(empty empty.c) +target_link_directories(empty PRIVATE $<HOST_LINK:/DIR>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries-stderr.txt new file mode 100644 index 0000000..6c4441f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-target_link_libraries.cmake:[0-9]+ \(target_link_libraries\): + Error evaluating generator expression: + + \$<HOST_LINK:lib> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries.cmake new file mode 100644 index 0000000..d74c92d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_link_libraries.cmake @@ -0,0 +1,7 @@ + +enable_language(C) + +add_library(lib empty.c) + +add_executable(empty empty.c) +target_link_libraries(empty PRIVATE $<HOST_LINK:lib>) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources-result.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources-stderr.txt new file mode 100644 index 0000000..0e25568 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at HOST_LINK-target_sources.cmake:[0-9]+ \(target_sources\): + Error evaluating generator expression: + + \$<HOST_LINK:empty.c> + + \$<HOST_LINK:...> may only be used with binary targets to specify link + options. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources.cmake b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources.cmake new file mode 100644 index 0000000..ea7bf55 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/HOST_LINK-target_sources.cmake @@ -0,0 +1,2 @@ +add_library(empty) +target_sources(empty PRIVATE $<HOST_LINK:empty.c>) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 6550f84..24c3642 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -64,6 +64,36 @@ run_cmake(LINK_LANG_AND_ID-wrong-usage1) run_cmake(LINK_LANG_AND_ID-wrong-usage2) run_cmake(LINK_LANG_AND_ID-wrong-usage3) run_cmake(LINK_LANG_AND_ID-file_generate) +run_cmake(HOST_LINK-add_custom_target) +run_cmake(HOST_LINK-add_custom_command) +run_cmake(HOST_LINK-install) +run_cmake(HOST_LINK-add_executable) +run_cmake(HOST_LINK-add_library) +run_cmake(HOST_LINK-add_test) +run_cmake(HOST_LINK-target_sources) +run_cmake(HOST_LINK-target_compile_definitions) +run_cmake(HOST_LINK-target_compile_options) +run_cmake(HOST_LINK-target_include_directories) +run_cmake(HOST_LINK-target_link_libraries) +run_cmake(HOST_LINK-target_link_directories) +if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)") + run_cmake(HOST_LINK-link_depends) +endif() +run_cmake(DEVICE_LINK-add_custom_target) +run_cmake(DEVICE_LINK-add_custom_command) +run_cmake(DEVICE_LINK-install) +run_cmake(DEVICE_LINK-add_executable) +run_cmake(DEVICE_LINK-add_library) +run_cmake(DEVICE_LINK-add_test) +run_cmake(DEVICE_LINK-target_sources) +run_cmake(DEVICE_LINK-target_compile_definitions) +run_cmake(DEVICE_LINK-target_compile_options) +run_cmake(DEVICE_LINK-target_include_directories) +run_cmake(DEVICE_LINK-target_link_libraries) +run_cmake(DEVICE_LINK-target_link_directories) +if(RunCMake_GENERATOR MATCHES "(Ninja|Makefile)") + run_cmake(DEVICE_LINK-link_depends) +endif() run_cmake(TARGET_FILE-recursion) run_cmake(OUTPUT_NAME-recursion) run_cmake(TARGET_FILE_PREFIX) diff --git a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake index 9fdcdee..af3e4c0 100644 --- a/Tests/RunCMake/target_link_options/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_options/RunCMakeTest.cmake @@ -44,6 +44,11 @@ if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel") run_cmake_target(genex_LINK_LANG_AND_ID mod LinkOptions_mod --config Release) run_cmake_target(genex_LINK_LANG_AND_ID exe LinkOptions_exe --config Release) + run_cmake(genex_DEVICE_LINK) + + run_cmake_target(genex_DEVICE_LINK interface LinkOptions_shared_interface --config Release) + run_cmake_target(genex_DEVICE_LINK private LinkOptions_private --config Release) + unset(RunCMake_TEST_OPTIONS) unset(RunCMake_TEST_OUTPUT_MERGE) endif() diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-interface-check.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-interface-check.cmake new file mode 100644 index 0000000..8431e22 --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-interface-check.cmake @@ -0,0 +1,3 @@ +set (DEVICE_LINK FALSE) + +include ("${CMAKE_CURRENT_LIST_DIR}/genex_DEVICE_LINK-validation.cmake") diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-interface-result.txt b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-interface-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-interface-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-private-check.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-private-check.cmake new file mode 100644 index 0000000..8431e22 --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-private-check.cmake @@ -0,0 +1,3 @@ +set (DEVICE_LINK FALSE) + +include ("${CMAKE_CURRENT_LIST_DIR}/genex_DEVICE_LINK-validation.cmake") diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-private-result.txt b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-private-result.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-private-result.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-validation.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-validation.cmake new file mode 100644 index 0000000..28f5d01 --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK-validation.cmake @@ -0,0 +1,22 @@ + +if (NOT DEFINED DEVICE_LINK) + set (DEVICE_LINK FALSE) +endif() + +if (DEVICE_LINK) + set (VALID_ID DEVICE_LINK) + set (INVALID_ID NORMAL_LINK) +else() + set (VALID_ID NORMAL_LINK) + set (INVALID_ID DEVICE_LINK) +endif() + +if (NOT actual_stdout MATCHES "BADFLAG_${VALID_ID}") + set (RunCMake_TEST_FAILED "Not found expected 'BADFLAG_${VALID_ID}'.") +endif() +if (actual_stdout MATCHES "BADFLAG_${INVALID_ID}") + if (RunCMake_TEST_FAILED) + string (APPEND RunCMake_TEST_FAILED "\n") + endif() + string (APPEND RunCMake_TEST_FAILED "Found unexpected 'BADFLAG_${INVALID_ID}'.") +endif() diff --git a/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake new file mode 100644 index 0000000..b3648e9 --- /dev/null +++ b/Tests/RunCMake/target_link_options/genex_DEVICE_LINK.cmake @@ -0,0 +1,19 @@ + +enable_language(C) + +set (obj "${CMAKE_C_OUTPUT_EXTENSION}") +if(BORLAND) + set(pre -) +endif() + +add_library(LinkOptions_interface INTERFACE) +target_link_options (LinkOptions_interface INTERFACE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}> + $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>) + +add_library(LinkOptions_shared_interface SHARED LinkOptionsLib.c) +target_link_libraries (LinkOptions_shared_interface PRIVATE LinkOptions_interface) + + +add_library(LinkOptions_private SHARED LinkOptionsLib.c) +target_link_options (LinkOptions_private PRIVATE $<DEVICE_LINK:${pre}BADFLAG_DEVICE_LINK${obj}> + $<HOST_LINK:${pre}BADFLAG_NORMAL_LINK${obj}>) |