From 2d4787fc4ddc077e1d8fcb807768d1ecc7902a73 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 29 May 2019 14:49:36 -0400 Subject: Genex: Add more extensive support for an unbounded number of parameters Previously genex support for unbounded number of parameters required at least 1 parameter. We now support zero or more parameters, and two or more parameters. --- Source/cmGeneratorExpressionEvaluator.cxx | 10 +++++++--- Source/cmGeneratorExpressionNode.h | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 268de6f..7442018 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -166,9 +166,13 @@ std::string GeneratorExpressionContent::EvaluateParameters( reportError(context, this->GetOriginalExpression(), "$<" + identifier + "> expression requires at least one parameter."); - } - if (numExpected == cmGeneratorExpressionNode::OneOrZeroParameters && - parameters.size() > 1) { + } else if (numExpected == cmGeneratorExpressionNode::TwoOrMoreParameters && + parameters.size() < 2) { + reportError(context, this->GetOriginalExpression(), + "$<" + identifier + + "> expression requires at least two parameters."); + } else if (numExpected == cmGeneratorExpressionNode::OneOrZeroParameters && + parameters.size() > 1) { reportError(context, this->GetOriginalExpression(), "$<" + identifier + "> expression requires one or zero parameters."); diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h index 3dbfc6e..7a36924 100644 --- a/Source/cmGeneratorExpressionNode.h +++ b/Source/cmGeneratorExpressionNode.h @@ -20,7 +20,9 @@ struct cmGeneratorExpressionNode { DynamicParameters = 0, OneOrMoreParameters = -1, - OneOrZeroParameters = -2 + TwoOrMoreParameters = -2, + ZeroOrMoreParameters = -3, + OneOrZeroParameters = -4 }; virtual ~cmGeneratorExpressionNode() = default; -- cgit v0.12 From ec66af2026e085e7b648b222794f0f213183ea1e Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 29 May 2019 14:55:18 -0400 Subject: Genex: CompilerId now can match against a list of ids. This allows for expressions like: $<$:-DMY_PRIVATE_DEFINE> --- Help/manual/cmake-generator-expressions.7.rst | 29 +++++++----- Source/cmGeneratorExpressionNode.cxx | 53 ++++++++++++---------- .../target_compile_options/CMakeLists.txt | 15 +++++- .../target_compile_options/consumer.cpp | 16 +++++++ .../CMakeCommands/target_compile_options/main.cpp | 12 +++++ Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt | 2 +- 6 files changed, 87 insertions(+), 40 deletions(-) diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index f2e6597..c03e701 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -114,20 +114,25 @@ Variable Queries ``1`` if the CMake's platform id matches ``platform_id`` otherwise ``0``. See also the :variable:`CMAKE_SYSTEM_NAME` variable. -``$`` - ``1`` if the CMake's compiler id of the C compiler matches ``compiler_id``, - otherwise ``0``. +``$`` + where ``compiler_ids`` is a comma-separated list. + ``1`` if the CMake's compiler id of the C compiler matches any one + of the entries in ``compiler_ids``, otherwise ``0``. See also the :variable:`CMAKE__COMPILER_ID` variable. -``$`` - ``1`` if the CMake's compiler id of the CXX compiler matches ``compiler_id``, - otherwise ``0``. -``$`` - ``1`` if the CMake's compiler id of the CUDA compiler matches ``compiler_id``, - otherwise ``0``. +``$`` + where ``compiler_ids`` is a comma-separated list. + ``1`` if the CMake's compiler id of the CXX compiler matches any one + of the entries in ``compiler_ids``, otherwise ``0``. See also the :variable:`CMAKE__COMPILER_ID` variable. -``$`` - ``1`` if the CMake's compiler id of the Fortran compiler matches ``compiler_id``, - otherwise ``0``. +``$`` + where ``compiler_ids`` is a comma-separated list. + ``1`` if the CMake's compiler id of the CUDA compiler matches any one + of the entries in ``compiler_ids``, otherwise ``0``. + See also the :variable:`CMAKE__COMPILER_ID` variable. +``$`` + where ``compiler_ids`` is a comma-separated list. + ``1`` if the CMake's compiler id of the Fortran compiler matches any one + of the entries in ``compiler_ids``, otherwise ``0``. See also the :variable:`CMAKE__COMPILER_ID` variable. ``$`` ``1`` if the version of the C compiler matches ``version``, otherwise ``0``. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 68ef170..7fcd3f3 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -632,7 +632,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode { } - int NumExpectedParameters() const override { return OneOrZeroParameters; } + int NumExpectedParameters() const override { return ZeroOrMoreParameters; } std::string Evaluate( const std::vector& parameters, @@ -664,36 +664,39 @@ struct CompilerIdNode : public cmGeneratorExpressionNode if (parameters.empty()) { return compilerId; } - static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); - if (!compilerIdValidator.find(parameters.front())) { - reportError(context, content->GetOriginalExpression(), - "Expression syntax not recognized."); - return std::string(); - } if (compilerId.empty()) { return parameters.front().empty() ? "1" : "0"; } + static cmsys::RegularExpression compilerIdValidator("^[A-Za-z0-9_]*$"); - if (strcmp(parameters.front().c_str(), compilerId.c_str()) == 0) { - return "1"; - } + for (auto& param : parameters) { - if (cmsysString_strcasecmp(parameters.front().c_str(), - compilerId.c_str()) == 0) { - switch (context->LG->GetPolicyStatus(cmPolicies::CMP0044)) { - case cmPolicies::WARN: { - std::ostringstream e; - e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0044); - context->LG->GetCMakeInstance()->IssueMessage( - MessageType::AUTHOR_WARNING, e.str(), context->Backtrace); - CM_FALLTHROUGH; + if (!compilerIdValidator.find(param)) { + reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + + if (strcmp(param.c_str(), compilerId.c_str()) == 0) { + return "1"; + } + + if (cmsysString_strcasecmp(param.c_str(), compilerId.c_str()) == 0) { + switch (context->LG->GetPolicyStatus(cmPolicies::CMP0044)) { + case cmPolicies::WARN: { + std::ostringstream e; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0044); + context->LG->GetCMakeInstance()->IssueMessage( + MessageType::AUTHOR_WARNING, e.str(), context->Backtrace); + CM_FALLTHROUGH; + } + case cmPolicies::OLD: + return "1"; + case cmPolicies::NEW: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + break; } - case cmPolicies::OLD: - return "1"; - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; } } return "0"; diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index a24cd53..ee187f5 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -7,9 +7,10 @@ add_executable(target_compile_options "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" ) target_compile_options(target_compile_options - PRIVATE $<$:-DMY_PRIVATE_DEFINE> + PRIVATE $<$:-DMY_PRIVATE_DEFINE> PUBLIC $<$:-DMY_PUBLIC_DEFINE> INTERFACE $<$:-DMY_INTERFACE_DEFINE> + INTERFACE $<$:-DMY_MULTI_COMP_INTERFACE_DEFINE> ) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") @@ -17,6 +18,11 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") PRIVATE "DO_GNU_TESTS" ) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + target_compile_definitions(target_compile_options + PRIVATE + "DO_CLANG_TESTS" + ) endif() add_executable(consumer @@ -40,7 +46,7 @@ if(CMAKE_GENERATOR MATCHES "Visual Studio") endif() target_compile_options(consumer - PRIVATE $<$:$> + PRIVATE $<$:$> ) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") @@ -48,6 +54,11 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") PRIVATE "DO_GNU_TESTS" ) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + target_compile_definitions(consumer + PRIVATE + "DO_CLANG_TESTS" + ) endif() # Test no items diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp index fe79eb5..5cbe049 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp @@ -13,6 +13,22 @@ # error Expected MY_INTERFACE_DEFINE # endif +# ifndef MY_MULTI_COMP_INTERFACE_DEFINE +# error Expected MY_MULTI_COMP_INTERFACE_DEFINE +# endif + +#endif + +#ifdef DO_CLANG_TESTS + +# ifdef MY_PRIVATE_DEFINE +# error Unexpected MY_PRIVATE_DEFINE +# endif + +# ifndef MY_MULTI_COMP_INTERFACE_DEFINE +# error Expected MY_MULTI_COMP_INTERFACE_DEFINE +# endif + #endif #ifndef CONSUMER_LANG_CXX diff --git a/Tests/CMakeCommands/target_compile_options/main.cpp b/Tests/CMakeCommands/target_compile_options/main.cpp index 829a25e..edefdf2 100644 --- a/Tests/CMakeCommands/target_compile_options/main.cpp +++ b/Tests/CMakeCommands/target_compile_options/main.cpp @@ -15,6 +15,18 @@ #endif +#ifdef DO_CLANG_TESTS + +# ifndef MY_PRIVATE_DEFINE +# error Expected MY_PRIVATE_DEFINE +# endif + +# ifdef MY_PUBLIC_DEFINE +# error Unexpected MY_PUBLIC_DEFINE +# endif + +#endif + int main() { return 0; diff --git a/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt b/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt index 16bcb36..66ff016 100644 --- a/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt +++ b/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt @@ -2,4 +2,4 @@ add_library(foo STATIC foo.cpp) string(TOLOWER ${CMAKE_CXX_COMPILER_ID} compiler_id) -target_compile_definitions(foo PRIVATE Foo=$) +target_compile_definitions(foo PRIVATE Foo=$) -- cgit v0.12 From 9fd602bfd33479b1acecd40e5c1b76ce37d59798 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 29 May 2019 14:55:45 -0400 Subject: Genex: PlatformId now can match against a list of ids. --- Help/manual/cmake-generator-expressions.7.rst | 7 ++++--- Source/cmGeneratorExpressionNode.cxx | 8 +++++--- Tests/GeneratorExpression/CMakeLists.txt | 1 + Tests/GeneratorExpression/check-part3.cmake | 5 +++++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index c03e701..1136151 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -110,9 +110,10 @@ Variable Queries The mapping in :prop_tgt:`MAP_IMPORTED_CONFIG_` is also considered by this expression when it is evaluated on a property on an :prop_tgt:`IMPORTED` target. -``$`` - ``1`` if the CMake's platform id matches ``platform_id`` - otherwise ``0``. +``$`` + where ``platform_ids`` is a comma-separated list. + ``1`` if the CMake's platform id matches any one of the entries in + ``platform_ids``, otherwise ``0``. See also the :variable:`CMAKE_SYSTEM_NAME` variable. ``$`` where ``compiler_ids`` is a comma-separated list. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 7fcd3f3..4744309 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -776,7 +776,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode { PlatformIdNode() {} // NOLINT(modernize-use-equals-default) - int NumExpectedParameters() const override { return OneOrZeroParameters; } + int NumExpectedParameters() const override { return ZeroOrMoreParameters; } std::string Evaluate( const std::vector& parameters, @@ -794,8 +794,10 @@ struct PlatformIdNode : public cmGeneratorExpressionNode return parameters.front().empty() ? "1" : "0"; } - if (parameters.front() == platformId) { - return "1"; + for (auto& param : parameters) { + if (param == platformId) { + return "1"; + } } return "0"; } diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 5ba0dc0..3ff2b85 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -220,6 +220,7 @@ add_custom_target(check-part3 ALL -Dtest_early_termination_2=$<$<1:>:, -Dsystem_name=${CMAKE_HOST_SYSTEM_NAME} -Dtest_platform_id=$ + -Dtest_platform_id_supported=$ -Dtest_platform_id_Linux=$ -Dtest_platform_id_Windows=$ -Dtest_platform_id_Darwin=$ diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index 9014406..4fb7308 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -28,11 +28,16 @@ check(test_early_termination_2 "$<:,") check(test_platform_id "${system_name}") foreach(system Linux Windows Darwin) if(system_name STREQUAL system) + check(test_platform_id_supported 1) check(test_platform_id_${system} 1) + set(platform_supported 1) else() check(test_platform_id_${system} 0) endif() endforeach() +if(NOT platform_supported) + check(test_platform_id_supported 0) +endif() check(lower_case "mi,xed") check(upper_case "MIX,ED") check(make_c_identifier "_4f_oo__bar__") -- cgit v0.12 From 808b8180632aef06e7a3644fb4d3957722abc3f3 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 30 May 2019 10:00:19 -0400 Subject: Genex: CompileLang and CompileLangAndId now match against a list of ids This allows for expressions such as: $ --- Help/manual/cmake-generator-expressions.7.rst | 24 +++++++++++----------- Source/cmGeneratorExpressionNode.cxx | 15 ++++++++++---- .../target_compile_definitions/CMakeLists.txt | 1 + .../target_compile_definitions/consumer.c | 4 ++++ .../target_compile_options/CMakeLists.txt | 1 + .../target_compile_options/consumer.cpp | 8 ++++++++ .../CMakeCommands/target_compile_options/main.cpp | 8 ++++++++ ...MPILE_LANG_AND_ID-add_custom_command-stderr.txt | 3 +-- .../COMPILE_LANG_AND_ID-target_sources-stderr.txt | 3 +-- 9 files changed, 47 insertions(+), 20 deletions(-) diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 1136151..c0449fb 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -164,20 +164,20 @@ Variable Queries .. _`Boolean COMPILE_LANGUAGE Generator Expression`: -``$`` +``$`` ``1`` when the language used for compilation unit matches ``language`` and - the CMake's compiler id of the language compiler matches ``compiler_id``, - otherwise ``0``. This expression is a short form for the combination of - ``$`` and ``$``. - This expression may be used to specify compile options, - compile definitions, and include directories for source files of a + the CMake's compiler id of the language compiler matches any one of the + entries in ``compiler_ids``, otherwise ``0``. This expression is a short form + for the combination of ``$`` and + ``$``. This expression may be used to specify + compile options, compile definitions, and include directories for source files of a particular language and compiler combination in a target. For example: .. code-block:: cmake add_executable(myapp main.cpp foo.c bar.cpp zot.cu) target_compile_definitions(myapp - PRIVATE $<$:COMPILING_CXX_WITH_CLANG> + PRIVATE $<$:COMPILING_CXX_WITH_CLANG> $<$:COMPILING_CXX_WITH_INTEL> $<$:COMPILING_C_WITH_CLANG> ) @@ -200,10 +200,10 @@ Variable Queries $<$,$>:COMPILING_C_WITH_CLANG> ) -``$`` - ``1`` when the language used for compilation unit matches ``language``, - otherwise ``0``. This expression may be used to specify compile options, - compile definitions, and include directories for source files of a +``$`` + ``1`` when the language used for compilation unit matches any of the entries + in ``languages``, otherwise ``0``. This expression may be used to specify + compile options, compile definitions, and include directories for source files of a particular language in a target. For example: .. code-block:: cmake @@ -217,7 +217,7 @@ Variable Queries $<$:COMPILING_CUDA> ) target_include_directories(myapp - PRIVATE $<$:/opt/foo/cxx_headers> + PRIVATE $<$:/opt/foo/headers> ) This specifies the use of the ``-fno-exceptions`` compile option, diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 4744309..a60c75c 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -951,7 +951,7 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode { CompileLanguageNode() {} // NOLINT(modernize-use-equals-default) - int NumExpectedParameters() const override { return OneOrZeroParameters; } + int NumExpectedParameters() const override { return ZeroOrMoreParameters; } std::string Evaluate( const std::vector& parameters, @@ -982,7 +982,13 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode if (parameters.empty()) { return context->Language; } - return context->Language == parameters.front() ? "1" : "0"; + + for (auto& param : parameters) { + if (context->Language == param) { + return "1"; + } + } + return "0"; } } languageNode; @@ -990,7 +996,7 @@ static const struct CompileLanguageAndIdNode : public cmGeneratorExpressionNode { CompileLanguageAndIdNode() {} // NOLINT(modernize-use-equals-default) - int NumExpectedParameters() const override { return 2; } + int NumExpectedParameters() const override { return TwoOrMoreParameters; } std::string Evaluate( const std::vector& parameters, @@ -1023,7 +1029,8 @@ static const struct CompileLanguageAndIdNode : public cmGeneratorExpressionNode const std::string& lang = context->Language; if (lang == parameters.front()) { - std::vector idParameter = { parameters[1] }; + std::vector idParameter((parameters.cbegin() + 1), + parameters.cend()); return CompilerIdNode{ lang.c_str() }.EvaluateWithLanguage( idParameter, context, content, dagChecker, lang); } diff --git a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt index 7dc7995..a5bc1e1 100644 --- a/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_definitions/CMakeLists.txt @@ -34,6 +34,7 @@ target_compile_definitions(consumer CONSUMER_LANG_$ LANG_IS_CXX=$ LANG_IS_C=$ + LANG_IS_C_OR_CXX=$ ) if(CMAKE_GENERATOR MATCHES "Visual Studio|Xcode") target_compile_definitions(consumer diff --git a/Tests/CMakeCommands/target_compile_definitions/consumer.c b/Tests/CMakeCommands/target_compile_definitions/consumer.c index bacd4c4..bb65e01 100644 --- a/Tests/CMakeCommands/target_compile_definitions/consumer.c +++ b/Tests/CMakeCommands/target_compile_definitions/consumer.c @@ -35,6 +35,10 @@ # endif #endif +#if !LANG_IS_C_OR_CXX +# error Expected LANG_IS_C_OR_CXX +#endif + void consumer_c() { } diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt index ee187f5..a7055b1 100644 --- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt +++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt @@ -9,6 +9,7 @@ add_executable(target_compile_options target_compile_options(target_compile_options PRIVATE $<$:-DMY_PRIVATE_DEFINE> PUBLIC $<$:-DMY_PUBLIC_DEFINE> + PUBLIC $<$:-DMY_MUTLI_COMP_PUBLIC_DEFINE> INTERFACE $<$:-DMY_INTERFACE_DEFINE> INTERFACE $<$:-DMY_MULTI_COMP_INTERFACE_DEFINE> ) diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp index 5cbe049..78928b4 100644 --- a/Tests/CMakeCommands/target_compile_options/consumer.cpp +++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp @@ -17,6 +17,10 @@ # error Expected MY_MULTI_COMP_INTERFACE_DEFINE # endif +# ifndef MY_MUTLI_COMP_PUBLIC_DEFINE +# error Expected MY_MUTLI_COMP_PUBLIC_DEFINE +# endif + #endif #ifdef DO_CLANG_TESTS @@ -29,6 +33,10 @@ # error Expected MY_MULTI_COMP_INTERFACE_DEFINE # endif +# ifndef MY_MUTLI_COMP_PUBLIC_DEFINE +# error Expected MY_MUTLI_COMP_PUBLIC_DEFINE +# endif + #endif #ifndef CONSUMER_LANG_CXX diff --git a/Tests/CMakeCommands/target_compile_options/main.cpp b/Tests/CMakeCommands/target_compile_options/main.cpp index edefdf2..7608400 100644 --- a/Tests/CMakeCommands/target_compile_options/main.cpp +++ b/Tests/CMakeCommands/target_compile_options/main.cpp @@ -9,6 +9,10 @@ # error Expected MY_PUBLIC_DEFINE # endif +# ifndef MY_MUTLI_COMP_PUBLIC_DEFINE +# error Expected MY_MUTLI_COMP_PUBLIC_DEFINE +# endif + # ifdef MY_INTERFACE_DEFINE # error Unexpected MY_INTERFACE_DEFINE # endif @@ -25,6 +29,10 @@ # error Unexpected MY_PUBLIC_DEFINE # endif +# ifndef MY_MUTLI_COMP_PUBLIC_DEFINE +# error Expected MY_MUTLI_COMP_PUBLIC_DEFINE +# endif + #endif int main() diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt index fc3c3de..2ee96ed 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-add_custom_command-stderr.txt @@ -3,7 +3,6 @@ CMake Error at COMPILE_LANG_AND_ID-add_custom_command.cmake:2 \(add_custom_comma \$ - \$ expression requires 2 comma separated parameters, - but got 0 instead. + \$ expression requires at least two parameters. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt index 44d8684..3ecbdc3 100644 --- a/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/COMPILE_LANG_AND_ID-target_sources-stderr.txt @@ -3,7 +3,6 @@ CMake Error at COMPILE_LANG_AND_ID-target_sources.cmake:2 \(target_sources\): \$ - \$ expression requires 2 comma separated parameters, - but got 0 instead. + \$ expression requires at least two parameters. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) -- cgit v0.12 From 162555d7ecd510a84fb26a2ebc90f0a3e9eabc1a Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Thu, 30 May 2019 16:46:22 -0400 Subject: Help: Add release notes for updated generator expressions --- Help/release/dev/genex-comma-separated.rst | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Help/release/dev/genex-comma-separated.rst diff --git a/Help/release/dev/genex-comma-separated.rst b/Help/release/dev/genex-comma-separated.rst new file mode 100644 index 0000000..f27f781 --- /dev/null +++ b/Help/release/dev/genex-comma-separated.rst @@ -0,0 +1,8 @@ +genex-comma-separated +--------------------- + +* The :manual:`generator expressions ` + ``C_COMPILER_ID``, ``CXX_COMPILER_ID``, ``CUDA_COMPILER_ID``, + ``Fortran_COMPILER_ID``, ``COMPILE_LANGUAGE``, ``COMPILE_LANG_AND_ID``, and + ``PLATFORM_ID`` learned to support matching one value from a comma-separated + list. -- cgit v0.12