diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index e29a2c84c5..0f1adfd18c 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -2511,6 +2511,46 @@ These expressions look up the values of The source file property will be read from the directory scope in which ``target`` was created (``target`` must therefore exist). +.. _`FileSet-Dependent Expressions`: + +FileSet-Dependent Expressions +----------------------------- + +FileSet Meta-Data +^^^^^^^^^^^^^^^^^ + +These expressions look up information about a file set. + +.. genex:: $ + + .. versionadded:: 4.3 + + ``1`` if the ``fileset`` exists as a CMake file set attached to the + ``target``, else ``0``. + + The possible sub-options are: + + ``TARGET:target`` + The target on which the file set depends. + +FileSet Properties +^^^^^^^^^^^^^^^^^^ + +These expressions look up the values of file set properties. + +.. genex:: $ + + .. versionadded:: 4.3 + + Value of the property ``prop`` on the file set ``fileset``, or empty if + the property is not set. An error will be raised if the file set is not + known by CMake. + + The possible sub-options are: + + ``TARGET:target`` + The target on which the file set depends. + .. _`Target-Dependent Expressions`: Target-Dependent Expressions diff --git a/Help/release/dev/GenEx-FILE_SET_PROPERTY.rst b/Help/release/dev/GenEx-FILE_SET_PROPERTY.rst new file mode 100644 index 0000000000..618fa067b5 --- /dev/null +++ b/Help/release/dev/GenEx-FILE_SET_PROPERTY.rst @@ -0,0 +1,5 @@ +GenEx-FILE_SET_PROPERTY +----------------------- + +* :genex:`$` and :genex:`$` generator + expressions were added to query CMake file set existence and properties. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 15e2497dc5..b938329896 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -29,6 +29,7 @@ #include "cmCMakePath.h" #include "cmCMakeString.hxx" #include "cmComputeLinkInformation.h" +#include "cmFileSet.h" #include "cmGenExContext.h" #include "cmGenExEvaluation.h" #include "cmGeneratorExpression.h" @@ -3578,6 +3579,128 @@ static const struct DeviceLinkNode : public cmGeneratorExpressionNode } } deviceLinkNode; +namespace { +bool GetFileSet(std::vector const& parameters, + cm::GenEx::Evaluation* eval, + GeneratorExpressionContent const* content, cmFileSet*& fileSet) +{ + auto const& fileSetName = parameters[0]; + auto targetName = parameters[1]; + auto* makefile = eval->Context.LG->GetMakefile(); + fileSet = nullptr; + + auto const TARGET = "TARGET:"_s; + + if (cmHasPrefix(targetName, TARGET)) { + targetName = targetName.substr(TARGET.length()); + if (targetName.empty()) { + reportError(eval, content->GetOriginalExpression(), + cmStrCat("No value provided for the ", TARGET, " option.")); + return false; + } + auto* target = makefile->FindTargetToUse(targetName); + if (!target) { + reportError(eval, content->GetOriginalExpression(), + cmStrCat("Non-existent target: ", targetName)); + return false; + } + fileSet = target->GetFileSet(fileSetName); + } else { + reportError(eval, content->GetOriginalExpression(), + cmStrCat("Invalid option. ", TARGET, " expected.")); + return false; + } + return true; +} +} + +static const struct FileSetExistsNode : public cmGeneratorExpressionNode +{ + FileSetExistsNode() {} // NOLINT(modernize-use-equals-default) + + // This node handles errors on parameter count itself. + int NumExpectedParameters() const override { return 2; } + + std::string Evaluate( + std::vector const& parameters, cm::GenEx::Evaluation* eval, + GeneratorExpressionContent const* content, + cmGeneratorExpressionDAGChecker* /*dagCheckerParent*/) const override + { + if (parameters[0].empty()) { + reportError( + eval, content->GetOriginalExpression(), + "$ expression requires a " + "non-empty FILE_SET name."); + return std::string{}; + } + + cmFileSet* fileSet = nullptr; + if (!GetFileSet(parameters, eval, content, fileSet)) { + return std::string{}; + } + + return fileSet ? "1" : "0"; + } +} fileSetExistsNode; + +static const struct FileSetPropertyNode : public cmGeneratorExpressionNode +{ + FileSetPropertyNode() {} // NOLINT(modernize-use-equals-default) + + // This node handles errors on parameter count itself. + int NumExpectedParameters() const override { return 3; } + + std::string Evaluate( + std::vector const& parameters, cm::GenEx::Evaluation* eval, + GeneratorExpressionContent const* content, + cmGeneratorExpressionDAGChecker* /*dagCheckerParent*/) const override + { + static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); + + std::string const& fileSetName = parameters.front(); + std::string const& propertyName = parameters.back(); + + if (fileSetName.empty() && propertyName.empty()) { + reportError(eval, content->GetOriginalExpression(), + "$ expression " + "requires a non-empty FILE_SET name and property name."); + return std::string{}; + } + if (fileSetName.empty()) { + reportError( + eval, content->GetOriginalExpression(), + "$ expression requires a " + "non-empty FILE_SET name."); + return std::string{}; + } + if (propertyName.empty()) { + reportError( + eval, content->GetOriginalExpression(), + "$ expression requires a " + "non-empty property name."); + return std::string{}; + } + if (!propertyNameValidator.find(propertyName)) { + reportError(eval, content->GetOriginalExpression(), + "Property name not supported."); + return std::string{}; + } + + cmFileSet* fileSet = nullptr; + if (!GetFileSet(parameters, eval, content, fileSet)) { + return std::string{}; + } + if (!fileSet) { + reportError( + eval, content->GetOriginalExpression(), + cmStrCat("FILE_SET \"", fileSetName, "\" is not known from CMake.")); + return std::string{}; + } + + return fileSet->GetProperty(propertyName); + } +} fileSetPropertyNode; + namespace { bool GetSourceFile( cmRange::const_iterator> parameters, @@ -5701,6 +5824,8 @@ cmGeneratorExpressionNode const* cmGeneratorExpressionNode::GetNode( { "QUOTE", "eNode }, { "SOURCE_EXISTS", &sourceExistsNode }, { "SOURCE_PROPERTY", &sourcePropertyNode }, + { "FILE_SET_EXISTS", &fileSetExistsNode }, + { "FILE_SET_PROPERTY", &fileSetPropertyNode }, { "TARGET_PROPERTY", &targetPropertyNode }, { "TARGET_INTERMEDIATE_DIR", &targetIntermediateDirNode }, { "TARGET_NAME", &targetNameNode }, diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 27d4a38b42..8d5308dd0e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -531,6 +531,8 @@ add_RunCMake_test(GenEx-TARGET_IMPORT_FILE) add_RunCMake_test(GenEx-GENEX_EVAL) add_RunCMake_test(GenEx-SOURCE_EXISTS) add_RunCMake_test(GenEx-SOURCE_PROPERTY) +add_RunCMake_test(GenEx-FILE_SET_EXISTS) +add_RunCMake_test(GenEx-FILE_SET_PROPERTY) add_RunCMake_test(GenEx-TARGET_PROPERTY) add_RunCMake_test(GenEx-TARGET_RUNTIME_DLLS) add_RunCMake_test(GenEx-STRING) diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/CMakeLists.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/CMakeLists.txt new file mode 100644 index 0000000000..cff7762b9e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 4.0...4.3) + +project(${RunCMake_TEST} NONE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/FILE_SET_EXISTS-check.cmake b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/FILE_SET_EXISTS-check.cmake new file mode 100644 index 0000000000..c3681060a2 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/FILE_SET_EXISTS-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/FILE_SET_EXISTS-generated.cmake") diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/FILE_SET_EXISTS.cmake b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/FILE_SET_EXISTS.cmake new file mode 100644 index 0000000000..3fed10e4f6 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/FILE_SET_EXISTS.cmake @@ -0,0 +1,19 @@ + +add_library(foo INTERFACE) +target_sources(foo INTERFACE FILE_SET foo TYPE HEADERS FILES file.h) + + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() + +]]) + +string(APPEND GENERATE_CONTENT + "check_value (\"\" \"$\" \"0\")\n" + "check_value (\"\" \"$\" \"1\")\n") + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/FILE_SET_EXISTS-generated.cmake" CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/RunCMakeTest.cmake new file mode 100644 index 0000000000..de3acf7aff --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/RunCMakeTest.cmake @@ -0,0 +1,11 @@ + +include(RunCMake) + +run_cmake(no-arguments) +run_cmake(bad-arguments) +run_cmake(no-fileset) +run_cmake(bad-option) +run_cmake(no-TARGET) +run_cmake(bad-TARGET) + +run_cmake(FILE_SET_EXISTS) diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-TARGET-result.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-TARGET-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-TARGET-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-TARGET-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-TARGET-stderr.txt new file mode 100644 index 0000000000..d0673380ea --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-TARGET-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at bad-TARGET\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Non-existent target: foo +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-TARGET.cmake b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-TARGET.cmake new file mode 100644 index 0000000000..fa487f5fdd --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-TARGET.cmake @@ -0,0 +1,3 @@ + + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-arguments-result.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-arguments-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-arguments-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-arguments-stderr.txt new file mode 100644 index 0000000000..915a52f85d --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-arguments-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at bad-arguments\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + \$ expression requires 2 comma separated parameters, but + got 3 instead. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-arguments.cmake b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-arguments.cmake new file mode 100644 index 0000000000..c741dc7dd1 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-option-result.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-option-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-option-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-option-stderr.txt new file mode 100644 index 0000000000..91576d6343 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-option-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at bad-option\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Invalid option. TARGET: expected. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-option.cmake b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-option.cmake new file mode 100644 index 0000000000..b418daa4c7 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/bad-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/file.h b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/file.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-TARGET-result.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-TARGET-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-TARGET-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-TARGET-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-TARGET-stderr.txt new file mode 100644 index 0000000000..1087ec28cc --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-TARGET-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at no-TARGET\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + No value provided for the TARGET: option. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-TARGET.cmake b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-TARGET.cmake new file mode 100644 index 0000000000..53fb9756b4 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-TARGET.cmake @@ -0,0 +1,3 @@ + + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-arguments-result.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-arguments-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-arguments-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-arguments-stderr.txt new file mode 100644 index 0000000000..79e8f63c78 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-arguments-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at no-arguments\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + \$ expression requires 2 comma separated parameters, but + got 0 instead. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-arguments.cmake b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-arguments.cmake new file mode 100644 index 0000000000..49478db588 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-fileset-result.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-fileset-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-fileset-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-fileset-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-fileset-stderr.txt new file mode 100644 index 0000000000..895cabccec --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-fileset-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at no-fileset\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + \$ expression requires a non-empty + FILE_SET name. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-fileset.cmake b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-fileset.cmake new file mode 100644 index 0000000000..2856b6539b --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_EXISTS/no-fileset.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/CMakeLists.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/CMakeLists.txt new file mode 100644 index 0000000000..cff7762b9e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 4.0...4.3) + +project(${RunCMake_TEST} NONE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/FILE_SET_PROPERTY-check.cmake b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/FILE_SET_PROPERTY-check.cmake new file mode 100644 index 0000000000..5469d2badd --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/FILE_SET_PROPERTY-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/FILE_SET_PROPERTY-generated.cmake") diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/FILE_SET_PROPERTY.cmake b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/FILE_SET_PROPERTY.cmake new file mode 100644 index 0000000000..20b6e7df5c --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/FILE_SET_PROPERTY.cmake @@ -0,0 +1,25 @@ + +set (GENERATE_CONTENT [[ +macro (CHECK_VALUE test_msg value expected) + if (NOT "${value}" STREQUAL "${expected}") + string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") + endif() +endmacro() + +]]) + +add_library(foo INTERFACE) +target_sources(foo INTERFACE FILE_SET foo TYPE HEADERS FILES file.h) + +set_property(FILE_SET foo TARGET foo PROPERTY FOO BAR) + +get_property(reference FILE_SET foo TARGET foo PROPERTY FOO) +string (APPEND GENERATE_CONTENT + "check_value (\"\" \"$\" \"${reference}\")\n") + +get_property(reference FILE_SET foo TARGET foo PROPERTY VOID) +string (APPEND GENERATE_CONTENT + "check_value (\"\" \"$\" \"${reference}\")\n") + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/FILE_SET_PROPERTY-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/RunCMakeTest.cmake new file mode 100644 index 0000000000..9eb1f30954 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/RunCMakeTest.cmake @@ -0,0 +1,14 @@ + +include(RunCMake) + +run_cmake(no-arguments) +run_cmake(bad-arguments) +run_cmake(no-fileset) +run_cmake(bad-fileset) +run_cmake(no-property) +run_cmake(bad-property) +run_cmake(bad-option) +run_cmake(no-TARGET) +run_cmake(bad-TARGET) + +run_cmake(FILE_SET_PROPERTY) diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-TARGET-result.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-TARGET-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-TARGET-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-TARGET-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-TARGET-stderr.txt new file mode 100644 index 0000000000..6ab5c42af6 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-TARGET-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at bad-TARGET\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Non-existent target: foo +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-TARGET.cmake b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-TARGET.cmake new file mode 100644 index 0000000000..782a9e6e8f --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-TARGET.cmake @@ -0,0 +1,3 @@ + + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-arguments-result.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-arguments-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-arguments-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-arguments-stderr.txt new file mode 100644 index 0000000000..acf7440d79 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-arguments-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at bad-arguments\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + \$ expression requires 3 comma separated parameters, but + got 4 instead. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-arguments.cmake b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-arguments.cmake new file mode 100644 index 0000000000..ce57b95af6 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-fileset-result.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-fileset-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-fileset-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-fileset-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-fileset-stderr.txt new file mode 100644 index 0000000000..1fc3ab17cd --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-fileset-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at bad-fileset\.cmake:4 \(file\): + Error evaluating generator expression: + + \$ + + FILE_SET "foo" is not known from CMake. +Call Stack \(most recent call first\): + CMakeLists\.txt:5 \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-fileset.cmake b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-fileset.cmake new file mode 100644 index 0000000000..66c036bfeb --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-fileset.cmake @@ -0,0 +1,4 @@ + +add_library(foo INTERFACE) + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-option-result.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-option-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-option-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-option-stderr.txt new file mode 100644 index 0000000000..cb64979b2b --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-option-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at bad-option\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Invalid option\. TARGET: expected\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-option.cmake b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-option.cmake new file mode 100644 index 0000000000..fc4051d59a --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-option.cmake @@ -0,0 +1,4 @@ + +add_library(foo INTERFACE) + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-property-result.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-property-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-property-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-property-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-property-stderr.txt new file mode 100644 index 0000000000..d325840724 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-property-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at bad-property\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Property name not supported. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-property.cmake b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-property.cmake new file mode 100644 index 0000000000..0a0f34a676 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/bad-property.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/file.h b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/file.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-TARGET-result.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-TARGET-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-TARGET-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-TARGET-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-TARGET-stderr.txt new file mode 100644 index 0000000000..ef98e316ca --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-TARGET-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at no-TARGET\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + No value provided for the TARGET: option. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-TARGET.cmake b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-TARGET.cmake new file mode 100644 index 0000000000..ba3ab7dd62 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-TARGET.cmake @@ -0,0 +1,3 @@ + + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-arguments-result.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-arguments-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-arguments-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-arguments-stderr.txt new file mode 100644 index 0000000000..08c11ce645 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-arguments-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at no-arguments\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + \$ expression requires 3 comma separated parameters, but + got 1 instead. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-arguments.cmake b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-arguments.cmake new file mode 100644 index 0000000000..bcd1352a30 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-fileset-result.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-fileset-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-fileset-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-fileset-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-fileset-stderr.txt new file mode 100644 index 0000000000..b840d6ac58 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-fileset-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at no-fileset\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + \$ expression requires a + non-empty FILE_SET name. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-fileset.cmake b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-fileset.cmake new file mode 100644 index 0000000000..6917c6c433 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-fileset.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$") diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-property-result.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-property-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-property-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-property-stderr.txt b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-property-stderr.txt new file mode 100644 index 0000000000..4eb19c8e85 --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-property-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at no-property\.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + \$ expression requires a + non-empty property name. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-property.cmake b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-property.cmake new file mode 100644 index 0000000000..d8c580dfba --- /dev/null +++ b/Tests/RunCMake/GenEx-FILE_SET_PROPERTY/no-property.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$")