From 60ec2922585d3710b45212fb5671676ff726965e Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Sun, 14 Apr 2019 19:48:39 +0200 Subject: Genex: Rename $ in $ --- Help/manual/cmake-generator-expressions.7.rst | 55 +++++++++---- Help/release/dev/genex-TARGET_FILE_BASE_NAME.rst | 7 ++ Help/release/dev/genex-TARGET_OUTPUT_NAME.rst | 7 -- Source/cmGeneratorExpressionNode.cxx | 32 ++++---- ...rtedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt | 1 + ...rtedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt | 8 ++ .../ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake | 2 + ...mportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt | 1 - ...mportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt | 8 -- .../ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake | 2 - ...idCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt | 1 + ...idCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt | 8 ++ ...onValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake | 9 ++ ...ValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt | 1 - ...ValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt | 8 -- .../NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake | 9 -- ...alidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt | 1 + ...alidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt | 9 ++ .../NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake | 9 ++ ...onValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt | 1 - ...onValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt | 9 -- .../NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake | 9 -- .../OUTPUT_NAME-recursion.cmake | 2 +- .../GeneratorExpression/RunCMakeTest.cmake | 16 ++-- .../TARGET_FILE_BASE_NAME-check.cmake | 2 + ...RGET_FILE_BASE_NAME-imported-target-check.cmake | 2 + .../TARGET_FILE_BASE_NAME-imported-target.cmake | 79 ++++++++++++++++++ ...RGET_FILE_BASE_NAME-non-valid-target-result.txt | 1 + ...RGET_FILE_BASE_NAME-non-valid-target-stderr.txt | 6 ++ .../TARGET_FILE_BASE_NAME-non-valid-target.cmake | 7 ++ .../TARGET_FILE_BASE_NAME.cmake | 96 ++++++++++++++++++++++ ...NKER_FILE_BASE_NAME-non-valid-target-result.txt | 1 + ...NKER_FILE_BASE_NAME-non-valid-target-stderr.txt | 6 ++ ...ET_LINKER_FILE_BASE_NAME-non-valid-target.cmake | 7 ++ ..._LINKER_OUTPUT_NAME-non-valid-target-result.txt | 1 - ..._LINKER_OUTPUT_NAME-non-valid-target-stderr.txt | 6 -- ...ARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake | 7 -- .../TARGET_OUTPUT_NAME-check.cmake | 2 - .../TARGET_OUTPUT_NAME-imported-target-check.cmake | 2 - .../TARGET_OUTPUT_NAME-imported-target.cmake | 79 ------------------ .../TARGET_OUTPUT_NAME-non-valid-target-result.txt | 1 - .../TARGET_OUTPUT_NAME-non-valid-target-stderr.txt | 6 -- .../TARGET_OUTPUT_NAME-non-valid-target.cmake | 7 -- .../GeneratorExpression/TARGET_OUTPUT_NAME.cmake | 96 ---------------------- ...lidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake | 7 ++ .../ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake | 16 ++++ .../ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake | 7 -- .../ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake | 16 ---- 48 files changed, 350 insertions(+), 325 deletions(-) create mode 100644 Help/release/dev/genex-TARGET_FILE_BASE_NAME.rst delete mode 100644 Help/release/dev/genex-TARGET_OUTPUT_NAME.rst create mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake delete mode 100644 Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index e9b3f4c..7f4761f 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -387,14 +387,25 @@ Target-Dependent Queries ``$`` Expands to the ``tgt`` if the given target exists, an empty string otherwise. -``$`` +``$`` + Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a + target. +``$`` Base name of main file where ``tgt`` is the name of a target. + The base name corresponds to the target file name (see + ``$``) without prefix and suffix. For example, if + target file name is ``libbase.so``, the base name is ``base``. + + See also the :prop_tgt:`OUTPUT_NAME`, :prop_tgt:`ARCHIVE_OUTPUT_NAME`, + :prop_tgt:`LIBRARY_OUTPUT_NAME` and :prop_tgt:`RUNTIME_OUTPUT_NAME` + target properties and their configuration specific variants + :prop_tgt:`OUTPUT_NAME_`, :prop_tgt:`ARCHIVE_OUTPUT_NAME_`, + :prop_tgt:`LIBRARY_OUTPUT_NAME_` and + :prop_tgt:`RUNTIME_OUTPUT_NAME_`. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$`` - Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a - target. ``$`` Prefix of main file where ``tgt`` is the name of a target. @@ -409,13 +420,23 @@ Target-Dependent Queries Name of main file (.exe, .so.1.2, .a). ``$`` Directory of main file (.exe, .so.1.2, .a). -``$`` +``$`` + File used to link (.a, .lib, .so) where ``tgt`` is the name of a target. +``$`` Base name of file used to link where ``tgt`` is the name of a target. + The base name corresponds to the target linker file name (see + ``$``) without prefix and suffix. For example, + if target file name is ``libbase.a``, the base name is ``base``. + + See also the :prop_tgt:`OUTPUT_NAME`, :prop_tgt:`ARCHIVE_OUTPUT_NAME`, + and :prop_tgt:`LIBRARY_OUTPUT_NAME` target properties and their configuration + specific variants :prop_tgt:`OUTPUT_NAME_`, + :prop_tgt:`ARCHIVE_OUTPUT_NAME_` and + :prop_tgt:`LIBRARY_OUTPUT_NAME_`. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$`` - File used to link (.a, .lib, .so) where ``tgt`` is the name of a target. ``$`` Prefix of file used to link where ``tgt`` is the name of a target. @@ -436,22 +457,26 @@ Target-Dependent Queries Name of file with soname (.so.3). ``$`` Directory of with soname (.so.3). -``$`` +``$`` + Full path to the linker generated program database file (.pdb) + where ``tgt`` is the name of a target. + + See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY` + target properties and their configuration specific variants + :prop_tgt:`PDB_NAME_` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_`. +``$`` Base name of the linker generated program database file (.pdb) where ``tgt`` is the name of a target. + The base name corresponds to the target PDB file name (see + ``$``) without prefix and suffix. For example, + if target file name is ``base.pdb``, the base name is ``base``. + See also the :prop_tgt:`PDB_NAME` target property and its configuration specific variant :prop_tgt:`PDB_NAME_`. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$`` - Full path to the linker generated program database file (.pdb) - where ``tgt`` is the name of a target. - - See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY` - target properties and their configuration specific variants - :prop_tgt:`PDB_NAME_` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_`. ``$`` Name of the linker generated program database file (.pdb). ``$`` diff --git a/Help/release/dev/genex-TARGET_FILE_BASE_NAME.rst b/Help/release/dev/genex-TARGET_FILE_BASE_NAME.rst new file mode 100644 index 0000000..d8b2b21 --- /dev/null +++ b/Help/release/dev/genex-TARGET_FILE_BASE_NAME.rst @@ -0,0 +1,7 @@ +genex-TARGET_FILE_BASE_NAME +--------------------------- + +* New ``$``, ``$`` + and ``$`` + :manual:`generator expressions ` have been + added to retrieve the base name of various artifacts. diff --git a/Help/release/dev/genex-TARGET_OUTPUT_NAME.rst b/Help/release/dev/genex-TARGET_OUTPUT_NAME.rst deleted file mode 100644 index e3ffe57..0000000 --- a/Help/release/dev/genex-TARGET_OUTPUT_NAME.rst +++ /dev/null @@ -1,7 +0,0 @@ -genex-TARGET_OUTPUT_NAME ------------------------- - -* New ``$``, ``$`` and - ``$`` - :manual:`generator expressions ` have been - added to retrieve the base name of various artifacts. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index af409e4..8b3d9d6 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -2210,8 +2210,8 @@ struct TargetOutputNameArtifactResultGetter // The file used to link to the target (.so, .lib, .a). if (!target->IsLinkable()) { ::reportError(context, content->GetOriginalExpression(), - "TARGET_LINKER_OUTPUT_NAME is allowed only for libraries " - "and executables with ENABLE_EXPORTS."); + "TARGET_LINKER_FILE_BASE_NAME is allowed only for " + "libraries and executables with ENABLE_EXPORTS."); return std::string(); } cmStateEnums::ArtifactType artifact = @@ -2232,7 +2232,7 @@ struct TargetOutputNameArtifactResultGetter if (target->IsImported()) { ::reportError( context, content->GetOriginalExpression(), - "TARGET_PDB_OUTPUT_NAME not allowed for IMPORTED targets."); + "TARGET_PDB_FILE_BASE_NAME not allowed for IMPORTED targets."); return std::string(); } @@ -2243,7 +2243,7 @@ struct TargetOutputNameArtifactResultGetter if (!context->LG->GetMakefile()->IsOn(pdbSupportVar)) { ::reportError( context, content->GetOriginalExpression(), - "TARGET_PDB_OUTPUT_NAME is not supported by the target linker."); + "TARGET_PDB_FILE_BASE_NAME is not supported by the target linker."); return std::string(); } @@ -2253,7 +2253,7 @@ struct TargetOutputNameArtifactResultGetter targetType != cmStateEnums::MODULE_LIBRARY && targetType != cmStateEnums::EXECUTABLE) { ::reportError(context, content->GetOriginalExpression(), - "TARGET_PDB_OUTPUT_NAME is allowed only for " + "TARGET_PDB_FILE_BASE_NAME is allowed only for " "targets with linker created artifacts."); return std::string(); } @@ -2263,9 +2263,9 @@ struct TargetOutputNameArtifactResultGetter }; template -struct TargetOutputNameArtifact : public TargetArtifactBase +struct TargetFileBaseNameArtifact : public TargetArtifactBase { - TargetOutputNameArtifact() {} // NOLINT(modernize-use-equals-default) + TargetFileBaseNameArtifact() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 1; } @@ -2290,12 +2290,12 @@ struct TargetOutputNameArtifact : public TargetArtifactBase } }; -static const TargetOutputNameArtifact targetOutputNameNode; - -static const TargetOutputNameArtifact - targetLinkerOutputNameNode; - -static const TargetOutputNameArtifact targetPdbOutputNameNode; +static const TargetFileBaseNameArtifact + targetFileBaseNameNode; +static const TargetFileBaseNameArtifact + targetLinkerFileBaseNameNode; +static const TargetFileBaseNameArtifact + targetPdbFileBaseNameNode; class ArtifactFilePrefixTag; class ArtifactLinkerFilePrefixTag; @@ -2474,6 +2474,9 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "TARGET_LINKER_FILE", &targetLinkerNodeGroup.File }, { "TARGET_SONAME_FILE", &targetSoNameNodeGroup.File }, { "TARGET_PDB_FILE", &targetPdbNodeGroup.File }, + { "TARGET_FILE_BASE_NAME", &targetFileBaseNameNode }, + { "TARGET_LINKER_FILE_BASE_NAME", &targetLinkerFileBaseNameNode }, + { "TARGET_PDB_FILE_BASE_NAME", &targetPdbFileBaseNameNode }, { "TARGET_FILE_PREFIX", &targetFilePrefixNode }, { "TARGET_LINKER_FILE_PREFIX", &targetLinkerFilePrefixNode }, { "TARGET_FILE_SUFFIX", &targetFileSuffixNode }, @@ -2488,9 +2491,6 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( { "TARGET_PDB_FILE_DIR", &targetPdbNodeGroup.FileDir }, { "TARGET_BUNDLE_DIR", &targetBundleDirNode }, { "TARGET_BUNDLE_CONTENT_DIR", &targetBundleContentDirNode }, - { "TARGET_OUTPUT_NAME", &targetOutputNameNode }, - { "TARGET_LINKER_OUTPUT_NAME", &targetLinkerOutputNameNode }, - { "TARGET_PDB_OUTPUT_NAME", &targetPdbOutputNameNode }, { "STREQUAL", &strEqualNode }, { "EQUAL", &equalNode }, { "IN_LIST", &inListNode }, diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt new file mode 100644 index 0000000..3b2a814 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE_BASE_NAME not allowed for IMPORTED targets. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..489d8e6 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake @@ -0,0 +1,2 @@ +add_library(empty UNKNOWN IMPORTED) +add_custom_target(custom COMMAND echo $) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt deleted file mode 100644 index 783bfb3..0000000 --- a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake:2 \(add_custom_target\): - Error evaluating generator expression: - - \$ - - TARGET_PDB_OUTPUT_NAME not allowed for IMPORTED targets. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake deleted file mode 100644 index 010b38e..0000000 --- a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME.cmake +++ /dev/null @@ -1,2 +0,0 @@ -add_library(empty UNKNOWN IMPORTED) -add_custom_target(custom COMMAND echo $) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt new file mode 100644 index 0000000..b061ce3 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE_BASE_NAME is not supported by the target linker. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..811c3f7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt deleted file mode 100644 index 00ec496..0000000 --- a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-stderr.txt +++ /dev/null @@ -1,8 +0,0 @@ -CMake Error at NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake:6 \(file\): - Error evaluating generator expression: - - \$ - - TARGET_PDB_OUTPUT_NAME is not supported by the target linker. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake deleted file mode 100644 index 07951de..0000000 --- a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake +++ /dev/null @@ -1,9 +0,0 @@ - -enable_language(C) - -add_library(empty STATIC empty.c) - -file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$]" -) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt new file mode 100644 index 0000000..c7d245c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake:6 \(file\): + Error evaluating generator expression: + + \$ + + TARGET_PDB_FILE_BASE_NAME is allowed only for targets with linker created + artifacts. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..811c3f7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt deleted file mode 100644 index 8ac349e..0000000 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-stderr.txt +++ /dev/null @@ -1,9 +0,0 @@ -CMake Error at NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake:6 \(file\): - Error evaluating generator expression: - - \$ - - TARGET_PDB_OUTPUT_NAME is allowed only for targets with linker created - artifacts. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake deleted file mode 100644 index 07951de..0000000 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake +++ /dev/null @@ -1,9 +0,0 @@ - -enable_language(C) - -add_library(empty STATIC empty.c) - -file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$]" -) diff --git a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake index 775f68a..006b0da 100644 --- a/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake +++ b/Tests/RunCMake/GeneratorExpression/OUTPUT_NAME-recursion.cmake @@ -3,4 +3,4 @@ add_executable(empty1 empty.c) set_property(TARGET empty1 PROPERTY OUTPUT_NAME $) add_executable(empty2 empty.c) -set_property(TARGET empty2 PROPERTY OUTPUT_NAME $) +set_property(TARGET empty2 PROPERTY OUTPUT_NAME $) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 0b0fb78..477b593 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -41,10 +41,10 @@ run_cmake(TARGET_FILE_SUFFIX) run_cmake(TARGET_FILE_SUFFIX-imported-target) run_cmake(TARGET_FILE_SUFFIX-non-valid-target) run_cmake(TARGET_LINKER_FILE_SUFFIX-non-valid-target) -run_cmake(TARGET_OUTPUT_NAME) -run_cmake(TARGET_OUTPUT_NAME-imported-target) -run_cmake(TARGET_OUTPUT_NAME-non-valid-target) -run_cmake(TARGET_LINKER_OUTPUT_NAME-non-valid-target) +run_cmake(TARGET_FILE_BASE_NAME) +run_cmake(TARGET_FILE_BASE_NAME-imported-target) +run_cmake(TARGET_FILE_BASE_NAME-non-valid-target) +run_cmake(TARGET_LINKER_FILE_BASE_NAME-non-valid-target) run_cmake(TARGET_PROPERTY-LOCATION) run_cmake(TARGET_PROPERTY-SOURCES) run_cmake(LINK_ONLY-not-linking) @@ -78,15 +78,15 @@ run_cmake(FILTER-Include) run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR) run_cmake(ImportedTarget-TARGET_PDB_FILE) -run_cmake(ImportedTarget-TARGET_PDB_OUTPUT_NAME) +run_cmake(ImportedTarget-TARGET_PDB_FILE_BASE_NAME) if(LINKER_SUPPORTS_PDB) run_cmake(NonValidTarget-TARGET_PDB_FILE) run_cmake(ValidTarget-TARGET_PDB_FILE) - run_cmake(NonValidTarget-TARGET_PDB_OUTPUT_NAME) - run_cmake(ValidTarget-TARGET_PDB_OUTPUT_NAME) + run_cmake(NonValidTarget-TARGET_PDB_FILE_BASE_NAME) + run_cmake(ValidTarget-TARGET_PDB_FILE_BASE_NAME) else() run_cmake(NonValidCompiler-TARGET_PDB_FILE) - run_cmake(NonValidCompiler-TARGET_PDB_OUTPUT_NAME) + run_cmake(NonValidCompiler-TARGET_PDB_FILE_BASE_NAME) endif() set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0085:STRING=OLD) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-check.cmake new file mode 100644 index 0000000..793edb1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target-check.cmake new file mode 100644 index 0000000..793edb1 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake new file mode 100644 index 0000000..aa54b31 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake @@ -0,0 +1,79 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +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_executable(exec1 IMPORTED) +add_library (shared1 SHARED IMPORTED) +add_library (static1 STATIC IMPORTED) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable default" "$" "exec1") +check_value ("TARGET_FILE_BASE_NAME shared default" "$" "shared1") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker default" "$" "shared1") +check_value ("TARGET_FILE_BASE_NAME static default" "$" "static1") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker default" "$" "static1") +]]) + + +add_executable (exec2 IMPORTED) +set_property (TARGET exec2 PROPERTY OUTPUT_NAME exec2_custom) +add_library (shared2 SHARED IMPORTED) +set_property (TARGET shared2 PROPERTY OUTPUT_NAME shared2_custom) +add_library (static2 STATIC IMPORTED) +set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable custom" "$" "exec2_custom") +check_value ("TARGET_FILE_BASE_NAME shared custom" "$" "shared2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker custom" "$" "shared2_custom") +check_value ("TARGET_FILE_BASE_NAME static custom" "$" "static2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker custom" "$" "static2_custom") +]]) + + +add_executable (exec3 IMPORTED) +set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime) +set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library) +set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive) +set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb) +add_library (shared3 SHARED IMPORTED) +set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime) +set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library) +set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive) +set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb) +add_library (static3 STATIC IMPORTED) +set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime) +set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library) +set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) +set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable all properties" "$" "exec3_runtime") +check_value ("TARGET_FILE_BASE_NAME shared all properties" "$" "$,Windows$CYGWIN>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$" "$,Windows$CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_FILE_BASE_NAME static all properties" "$" "static3_archive") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties" "$" "static3_archive") +]]) + + +unset(GENERATE_CONDITION) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $) +endif() + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake" + CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt new file mode 100644 index 0000000..ecb9e5d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_FILE_BASE_NAME-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target.cmake new file mode 100644 index 0000000..8622b7d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target.cmake @@ -0,0 +1,7 @@ + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..5ea53a0 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake @@ -0,0 +1,96 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +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_executable (exec1 empty.c) +add_library (shared1 SHARED empty.c) +add_library (static1 STATIC empty.c) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable default" "$" "exec1") +check_value ("TARGET_FILE_BASE_NAME shared default" "$" "shared1") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker default" "$" "shared1") +check_value ("TARGET_FILE_BASE_NAME static default" "$" "static1") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker default" "$" "static1") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string(APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB default" "$" "exec1") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB default" "$" "shared1") +]]) +endif() + + +add_executable (exec2 empty.c) +set_property (TARGET exec2 PROPERTY OUTPUT_NAME exec2_custom) +add_library (shared2 SHARED empty.c) +set_property (TARGET shared2 PROPERTY OUTPUT_NAME shared2_custom) +add_library (static2 STATIC empty.c) +set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable custom" "$" "exec2_custom") +check_value ("TARGET_FILE_BASE_NAME shared custom" "$" "shared2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker custom" "$" "shared2_custom") +check_value ("TARGET_FILE_BASE_NAME static custom" "$" "static2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker custom" "$" "static2_custom") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB custom" "$" "exec2_custom") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB custom" "$" "shared2_custom") + ]]) +endif() + +add_executable (exec3 empty.c) +set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime) +set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library) +set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive) +set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb) +add_library (shared3 SHARED empty.c) +set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime) +set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library) +set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive) +set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb) +add_library (static3 STATIC empty.c) +set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime) +set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library) +set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) +set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable all properties" "$" "exec3_runtime") +check_value ("TARGET_FILE_BASE_NAME shared all properties" "$" "$,Windows$CYGWIN>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$" "$,Windows$CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_FILE_BASE_NAME static all properties" "$" "static3_archive") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties" "$" "static3_archive") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB all properties" "$" "exec3_pdb") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB all properties" "$" "shared3_pdb") +]]) +endif() + + +unset(GENERATE_CONDITION) +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $) +endif() + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake" + CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt new file mode 100644 index 0000000..1ae2f2c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$ + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake new file mode 100644 index 0000000..776fb4b --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake @@ -0,0 +1,7 @@ + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$]" +) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt deleted file mode 100644 index 0e09469..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake:[0-9]+ \(file\): - Error evaluating generator expression: - - \$ - - Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake deleted file mode 100644 index c439535..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -add_custom_target(empty) - -file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$]" -) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake deleted file mode 100644 index fa4f2b9..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-check.cmake +++ /dev/null @@ -1,2 +0,0 @@ - -include ("${RunCMake_TEST_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake deleted file mode 100644 index fa4f2b9..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target-check.cmake +++ /dev/null @@ -1,2 +0,0 @@ - -include ("${RunCMake_TEST_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake deleted file mode 100644 index 548a2d7..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake +++ /dev/null @@ -1,79 +0,0 @@ - -cmake_minimum_required(VERSION 3.14) - -enable_language (C) - -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_executable(exec1 IMPORTED) -add_library (shared1 SHARED IMPORTED) -add_library (static1 STATIC IMPORTED) - -string (APPEND GENERATE_CONTENT [[ - -check_value ("TARGET_OUTPUT_NAME executable default" "$" "exec1") -check_value ("TARGET_OUTPUT_NAME shared default" "$" "shared1") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker default" "$" "shared1") -check_value ("TARGET_OUTPUT_NAME static default" "$" "static1") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker default" "$" "static1") -]]) - - -add_executable (exec2 IMPORTED) -set_property (TARGET exec2 PROPERTY OUTPUT_NAME exec2_custom) -add_library (shared2 SHARED IMPORTED) -set_property (TARGET shared2 PROPERTY OUTPUT_NAME shared2_custom) -add_library (static2 STATIC IMPORTED) -set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom) - -string (APPEND GENERATE_CONTENT [[ - -check_value ("TARGET_OUTPUT_NAME executable custom" "$" "exec2_custom") -check_value ("TARGET_OUTPUT_NAME shared custom" "$" "shared2_custom") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker custom" "$" "shared2_custom") -check_value ("TARGET_OUTPUT_NAME static custom" "$" "static2_custom") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker custom" "$" "static2_custom") -]]) - - -add_executable (exec3 IMPORTED) -set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime) -set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library) -set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive) -set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb) -add_library (shared3 SHARED IMPORTED) -set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime) -set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library) -set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive) -set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb) -add_library (static3 STATIC IMPORTED) -set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime) -set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library) -set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) -set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) - -string (APPEND GENERATE_CONTENT [[ - -check_value ("TARGET_OUTPUT_NAME executable all properties" "$" "exec3_runtime") -check_value ("TARGET_OUTPUT_NAME shared all properties" "$" "$,Windows$CYGWIN>,shared3_runtime,shared3_library>") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker all properties" "$" "$,Windows$CYGWIN>,shared3_archive,shared3_library>") -check_value ("TARGET_OUTPUT_NAME static all properties" "$" "static3_archive") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker all properties" "$" "static3_archive") -]]) - - -unset(GENERATE_CONDITION) -get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(_isMultiConfig) - list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) - set(GENERATE_CONDITION CONDITION $) -endif() - -file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake" - CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt deleted file mode 100644 index 9672a99..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at TARGET_OUTPUT_NAME-non-valid-target.cmake:[0-9]+ \(file\): - Error evaluating generator expression: - - \$ - - Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake deleted file mode 100644 index 5248dfa..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -add_custom_target(empty) - -file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$]" -) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake deleted file mode 100644 index b7bae15..0000000 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME.cmake +++ /dev/null @@ -1,96 +0,0 @@ - -cmake_minimum_required(VERSION 3.14) - -enable_language (C) - -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_executable (exec1 empty.c) -add_library (shared1 SHARED empty.c) -add_library (static1 STATIC empty.c) - -string (APPEND GENERATE_CONTENT [[ - -check_value ("TARGET_OUTPUT_NAME executable default" "$" "exec1") -check_value ("TARGET_OUTPUT_NAME shared default" "$" "shared1") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker default" "$" "shared1") -check_value ("TARGET_OUTPUT_NAME static default" "$" "static1") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker default" "$" "static1") -]]) -if (CMAKE_C_LINKER_SUPPORTS_PDB) - string(APPEND GENERATE_CONTENT [[ -check_value ("TARGET_PDB_OUTPUT_NAME executable PDB default" "$" "exec1") -check_value ("TARGET_PDB_OUTPUT_NAME shared PDB default" "$" "shared1") -]]) -endif() - - -add_executable (exec2 empty.c) -set_property (TARGET exec2 PROPERTY OUTPUT_NAME exec2_custom) -add_library (shared2 SHARED empty.c) -set_property (TARGET shared2 PROPERTY OUTPUT_NAME shared2_custom) -add_library (static2 STATIC empty.c) -set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom) - -string (APPEND GENERATE_CONTENT [[ - -check_value ("TARGET_OUTPUT_NAME executable custom" "$" "exec2_custom") -check_value ("TARGET_OUTPUT_NAME shared custom" "$" "shared2_custom") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker custom" "$" "shared2_custom") -check_value ("TARGET_OUTPUT_NAME static custom" "$" "static2_custom") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker custom" "$" "static2_custom") -]]) -if (CMAKE_C_LINKER_SUPPORTS_PDB) - string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_PDB_OUTPUT_NAME executable PDB custom" "$" "exec2_custom") -check_value ("TARGET_PDB_OUTPUT_NAME shared PDB custom" "$" "shared2_custom") - ]]) -endif() - -add_executable (exec3 empty.c) -set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime) -set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library) -set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive) -set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb) -add_library (shared3 SHARED empty.c) -set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime) -set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library) -set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive) -set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb) -add_library (static3 STATIC empty.c) -set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime) -set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library) -set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) -set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) - -string (APPEND GENERATE_CONTENT [[ - -check_value ("TARGET_OUTPUT_NAME executable all properties" "$" "exec3_runtime") -check_value ("TARGET_OUTPUT_NAME shared all properties" "$" "$,Windows$CYGWIN>,shared3_runtime,shared3_library>") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker all properties" "$" "$,Windows$CYGWIN>,shared3_archive,shared3_library>") -check_value ("TARGET_OUTPUT_NAME static all properties" "$" "static3_archive") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker all properties" "$" "static3_archive") -]]) -if (CMAKE_C_LINKER_SUPPORTS_PDB) - string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_PDB_OUTPUT_NAME executable PDB all properties" "$" "exec3_pdb") -check_value ("TARGET_PDB_OUTPUT_NAME shared PDB all properties" "$" "shared3_pdb") -]]) -endif() - - -unset(GENERATE_CONDITION) -get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(_isMultiConfig) - list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) - set(GENERATE_CONDITION CONDITION $) -endif() - -file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake" - CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake new file mode 100644 index 0000000..996d2d4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake @@ -0,0 +1,7 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT ENCODING UTF-8) + +list(GET TEST_TXT 0 PDB_FILE_BASE_NAME) + +if(NOT PDB_FILE_BASE_NAME MATCHES "empty") + set(RunCMake_TEST_FAILED "unexpected PDB_FILE_BASE_NAME [${PDB_FILE_BASE_NAME}]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..cc53bdf --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake @@ -0,0 +1,16 @@ + +enable_language(C) + +add_library(empty SHARED empty.c) + +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) + list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) + set(GENERATE_CONDITION CONDITION $) +endif() + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "$" + ${GENERATE_CONDITION} +) diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake deleted file mode 100644 index 8d1103e..0000000 --- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME-check.cmake +++ /dev/null @@ -1,7 +0,0 @@ -file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT ENCODING UTF-8) - -list(GET TEST_TXT 0 PDB_OUTPUT_NAME) - -if(NOT PDB_OUTPUT_NAME MATCHES "empty") - set(RunCMake_TEST_FAILED "unexpected PDB_OUTPUT_NAME [${PDB_OUTPUT_NAME}]") -endif() diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake deleted file mode 100644 index ba70b43..0000000 --- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake +++ /dev/null @@ -1,16 +0,0 @@ - -enable_language(C) - -add_library(empty SHARED empty.c) - -get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(_isMultiConfig) - list(GET CMAKE_CONFIGURATION_TYPES 0 FIRST_CONFIG) - set(GENERATE_CONDITION CONDITION $) -endif() - -file(GENERATE - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "$" - ${GENERATE_CONDITION} -) -- cgit v0.12