diff options
37 files changed, 239 insertions, 214 deletions
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 ``$<TARGET_NAME_IF_EXISTS:tgt>`` Expands to the ``tgt`` if the given target exists, an empty string otherwise. -``$<TARGET_OUTPUT_NAME:tgt>`` +``$<TARGET_FILE:tgt>`` + Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a + target. +``$<TARGET_FILE_BASE_NAME:tgt>`` Base name of main file where ``tgt`` is the name of a target. + The base name corresponds to the target file name (see + ``$<TARGET_FILE_NAME:tgt>``) 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_<CONFIG>`, :prop_tgt:`ARCHIVE_OUTPUT_NAME_<CONFIG>`, + :prop_tgt:`LIBRARY_OUTPUT_NAME_<CONFIG>` and + :prop_tgt:`RUNTIME_OUTPUT_NAME_<CONFIG>`. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$<TARGET_FILE:tgt>`` - Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a - target. ``$<TARGET_FILE_PREFIX:tgt>`` 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). ``$<TARGET_FILE_DIR:tgt>`` Directory of main file (.exe, .so.1.2, .a). -``$<TARGET_LINKER_OUTPUT_NAME:tgt>`` +``$<TARGET_LINKER_FILE:tgt>`` + File used to link (.a, .lib, .so) where ``tgt`` is the name of a target. +``$<TARGET_LINKER_FILE_BASE_NAME:tgt>`` 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 + ``$<TARGET_LINKER_FILE_NAME:tgt>``) 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_<CONFIG>`, + :prop_tgt:`ARCHIVE_OUTPUT_NAME_<CONFIG>` and + :prop_tgt:`LIBRARY_OUTPUT_NAME_<CONFIG>`. + Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$<TARGET_LINKER_FILE:tgt>`` - File used to link (.a, .lib, .so) where ``tgt`` is the name of a target. ``$<TARGET_LINKER_FILE_PREFIX:tgt>`` 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). ``$<TARGET_SONAME_FILE_DIR:tgt>`` Directory of with soname (.so.3). -``$<TARGET_PDB_OUTPUT_NAME:tgt>`` +``$<TARGET_PDB_FILE:tgt>`` + 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_<CONFIG>` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_<CONFIG>`. +``$<TARGET_PDB_FILE_BASE_NAME:tgt>`` 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 + ``$<TARGET_PDB_FILE_NAME:tgt>``) 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_<CONFIG>`. Note that ``tgt`` is not added as a dependency of the target this expression is evaluated on. -``$<TARGET_PDB_FILE:tgt>`` - 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_<CONFIG>` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_<CONFIG>`. ``$<TARGET_PDB_FILE_NAME:tgt>`` Name of the linker generated program database file (.pdb). ``$<TARGET_PDB_FILE_DIR:tgt>`` 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 ``$<TARGET_FILE_BASE_NAME:...>``, ``$<TARGET_LINKER_FILE_BASE_NAME:...>`` + and ``$<TARGET_PDB_FILE_BASE_NAME:...>`` + :manual:`generator expressions <cmake-generator-expressions(7)>` 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 ``$<TARGET_OUTPUT_NAME:...>``, ``$<TARGET_LINKER_OUTPUT_NAME:...>`` and - ``$<TARGET_PDB_OUTPUT_NAME:...>`` - :manual:`generator expressions <cmake-generator-expressions(7)>` 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<ArtifactLinkerTag> // 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<ArtifactPdbTag> 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<ArtifactPdbTag> 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<ArtifactPdbTag> 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<ArtifactPdbTag> }; template <typename ArtifactT> -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<ArtifactNameTag> targetOutputNameNode; - -static const TargetOutputNameArtifact<ArtifactLinkerTag> - targetLinkerOutputNameNode; - -static const TargetOutputNameArtifact<ArtifactPdbTag> targetPdbOutputNameNode; +static const TargetFileBaseNameArtifact<ArtifactNameTag> + targetFileBaseNameNode; +static const TargetFileBaseNameArtifact<ArtifactLinkerTag> + targetLinkerFileBaseNameNode; +static const TargetFileBaseNameArtifact<ArtifactPdbTag> + 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/TARGET_OUTPUT_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target-result.txt +++ b/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt 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:empty> + + 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 $<TARGET_PDB_FILE_BASE_NAME:empty>) 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:empty> - - 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 $<TARGET_PDB_OUTPUT_NAME:empty>) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target-result.txt +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt 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:empty> + + 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/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake index 07951de..811c3f7 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME.cmake +++ b/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake @@ -5,5 +5,5 @@ add_library(empty STATIC empty.c) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$<TARGET_PDB_OUTPUT_NAME:empty>]" + CONTENT "[$<TARGET_PDB_FILE_BASE_NAME:empty>]" ) 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:empty> - - 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/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_OUTPUT_NAME-result.txt +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt 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:empty> + + 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/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake index 07951de..811c3f7 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME.cmake +++ b/Tests/RunCMake/GeneratorExpression/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake @@ -5,5 +5,5 @@ add_library(empty STATIC empty.c) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$<TARGET_PDB_OUTPUT_NAME:empty>]" + CONTENT "[$<TARGET_PDB_FILE_BASE_NAME:empty>]" ) 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:empty> - - 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/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 $<TARGET_FILE_NAME:empty1>) add_executable(empty2 empty.c) -set_property(TARGET empty2 PROPERTY OUTPUT_NAME $<TARGET_OUTPUT_NAME:empty2>) +set_property(TARGET empty2 PROPERTY OUTPUT_NAME $<TARGET_FILE_BASE_NAME:empty2>) 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_OUTPUT_NAME-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake index 548a2d7..aa54b31 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-imported-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake @@ -17,11 +17,11 @@ add_library (static1 STATIC IMPORTED) string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_OUTPUT_NAME executable default" "$<TARGET_OUTPUT_NAME:exec1>" "exec1") -check_value ("TARGET_OUTPUT_NAME shared default" "$<TARGET_OUTPUT_NAME:shared1>" "shared1") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker default" "$<TARGET_LINKER_OUTPUT_NAME:shared1>" "shared1") -check_value ("TARGET_OUTPUT_NAME static default" "$<TARGET_OUTPUT_NAME:static1>" "static1") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker default" "$<TARGET_LINKER_OUTPUT_NAME:static1>" "static1") +check_value ("TARGET_FILE_BASE_NAME executable default" "$<TARGET_FILE_BASE_NAME:exec1>" "exec1") +check_value ("TARGET_FILE_BASE_NAME shared default" "$<TARGET_FILE_BASE_NAME:shared1>" "shared1") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker default" "$<TARGET_LINKER_FILE_BASE_NAME:shared1>" "shared1") +check_value ("TARGET_FILE_BASE_NAME static default" "$<TARGET_FILE_BASE_NAME:static1>" "static1") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker default" "$<TARGET_LINKER_FILE_BASE_NAME:static1>" "static1") ]]) @@ -34,11 +34,11 @@ set_property (TARGET static2 PROPERTY OUTPUT_NAME static2_custom) string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_OUTPUT_NAME executable custom" "$<TARGET_OUTPUT_NAME:exec2>" "exec2_custom") -check_value ("TARGET_OUTPUT_NAME shared custom" "$<TARGET_OUTPUT_NAME:shared2>" "shared2_custom") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker custom" "$<TARGET_LINKER_OUTPUT_NAME:shared2>" "shared2_custom") -check_value ("TARGET_OUTPUT_NAME static custom" "$<TARGET_OUTPUT_NAME:static2>" "static2_custom") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker custom" "$<TARGET_LINKER_OUTPUT_NAME:static2>" "static2_custom") +check_value ("TARGET_FILE_BASE_NAME executable custom" "$<TARGET_FILE_BASE_NAME:exec2>" "exec2_custom") +check_value ("TARGET_FILE_BASE_NAME shared custom" "$<TARGET_FILE_BASE_NAME:shared2>" "shared2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker custom" "$<TARGET_LINKER_FILE_BASE_NAME:shared2>" "shared2_custom") +check_value ("TARGET_FILE_BASE_NAME static custom" "$<TARGET_FILE_BASE_NAME:static2>" "static2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker custom" "$<TARGET_LINKER_FILE_BASE_NAME:static2>" "static2_custom") ]]) @@ -60,11 +60,11 @@ set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_OUTPUT_NAME executable all properties" "$<TARGET_OUTPUT_NAME:exec3>" "exec3_runtime") -check_value ("TARGET_OUTPUT_NAME shared all properties" "$<TARGET_OUTPUT_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_runtime,shared3_library>") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker all properties" "$<TARGET_LINKER_OUTPUT_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_archive,shared3_library>") -check_value ("TARGET_OUTPUT_NAME static all properties" "$<TARGET_OUTPUT_NAME:static3>" "static3_archive") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker all properties" "$<TARGET_LINKER_OUTPUT_NAME:static3>" "static3_archive") +check_value ("TARGET_FILE_BASE_NAME executable all properties" "$<TARGET_FILE_BASE_NAME:exec3>" "exec3_runtime") +check_value ("TARGET_FILE_BASE_NAME shared all properties" "$<TARGET_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_FILE_BASE_NAME static all properties" "$<TARGET_FILE_BASE_NAME:static3>" "static3_archive") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:static3>" "static3_archive") ]]) @@ -75,5 +75,5 @@ if(_isMultiConfig) set(GENERATE_CONDITION CONDITION $<CONFIG:${FIRST_CONFIG}>) endif() -file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_OUTPUT_NAME-generated.cmake" +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake" CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/GeneratorExpression/NonValidCompiler-TARGET_PDB_OUTPUT_NAME-result.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target-result.txt 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_FILE_BASE_NAME:empty> + + 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_FILE_BASE_NAME-non-valid-target.cmake index 5248dfa..8622b7d 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_OUTPUT_NAME-non-valid-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-non-valid-target.cmake @@ -3,5 +3,5 @@ add_custom_target(empty) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$<TARGET_OUTPUT_NAME:empty>]" + CONTENT "[$<TARGET_FILE_BASE_NAME:empty>]" ) 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" "$<TARGET_FILE_BASE_NAME:exec1>" "exec1") +check_value ("TARGET_FILE_BASE_NAME shared default" "$<TARGET_FILE_BASE_NAME:shared1>" "shared1") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker default" "$<TARGET_LINKER_FILE_BASE_NAME:shared1>" "shared1") +check_value ("TARGET_FILE_BASE_NAME static default" "$<TARGET_FILE_BASE_NAME:static1>" "static1") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker default" "$<TARGET_LINKER_FILE_BASE_NAME:static1>" "static1") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string(APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB default" "$<TARGET_PDB_FILE_BASE_NAME:exec1>" "exec1") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB default" "$<TARGET_PDB_FILE_BASE_NAME:shared1>" "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" "$<TARGET_FILE_BASE_NAME:exec2>" "exec2_custom") +check_value ("TARGET_FILE_BASE_NAME shared custom" "$<TARGET_FILE_BASE_NAME:shared2>" "shared2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker custom" "$<TARGET_LINKER_FILE_BASE_NAME:shared2>" "shared2_custom") +check_value ("TARGET_FILE_BASE_NAME static custom" "$<TARGET_FILE_BASE_NAME:static2>" "static2_custom") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker custom" "$<TARGET_LINKER_FILE_BASE_NAME:static2>" "static2_custom") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB custom" "$<TARGET_PDB_FILE_BASE_NAME:exec2>" "exec2_custom") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB custom" "$<TARGET_PDB_FILE_BASE_NAME:shared2>" "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" "$<TARGET_FILE_BASE_NAME:exec3>" "exec3_runtime") +check_value ("TARGET_FILE_BASE_NAME shared all properties" "$<TARGET_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_FILE_BASE_NAME static all properties" "$<TARGET_FILE_BASE_NAME:static3>" "static3_archive") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:static3>" "static3_archive") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB all properties" "$<TARGET_PDB_FILE_BASE_NAME:exec3>" "exec3_pdb") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB all properties" "$<TARGET_PDB_FILE_BASE_NAME:shared3>" "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 $<CONFIG:${FIRST_CONFIG}>) +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/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/GeneratorExpression/ImportedTarget-TARGET_PDB_OUTPUT_NAME-result.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt 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_LINKER_FILE_BASE_NAME:empty> + + 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_FILE_BASE_NAME-non-valid-target.cmake index c439535..776fb4b 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_OUTPUT_NAME-non-valid-target.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake @@ -3,5 +3,5 @@ add_custom_target(empty) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "[$<TARGET_LINKER_OUTPUT_NAME:empty>]" + CONTENT "[$<TARGET_LINKER_FILE_BASE_NAME:empty>]" ) 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_LINKER_OUTPUT_NAME:empty> - - Target "empty" is not an executable or library\. 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-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_OUTPUT_NAME:empty> - - Target "empty" is not an executable or library\. 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" "$<TARGET_OUTPUT_NAME:exec1>" "exec1") -check_value ("TARGET_OUTPUT_NAME shared default" "$<TARGET_OUTPUT_NAME:shared1>" "shared1") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker default" "$<TARGET_LINKER_OUTPUT_NAME:shared1>" "shared1") -check_value ("TARGET_OUTPUT_NAME static default" "$<TARGET_OUTPUT_NAME:static1>" "static1") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker default" "$<TARGET_LINKER_OUTPUT_NAME:static1>" "static1") -]]) -if (CMAKE_C_LINKER_SUPPORTS_PDB) - string(APPEND GENERATE_CONTENT [[ -check_value ("TARGET_PDB_OUTPUT_NAME executable PDB default" "$<TARGET_PDB_OUTPUT_NAME:exec1>" "exec1") -check_value ("TARGET_PDB_OUTPUT_NAME shared PDB default" "$<TARGET_PDB_OUTPUT_NAME:shared1>" "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" "$<TARGET_OUTPUT_NAME:exec2>" "exec2_custom") -check_value ("TARGET_OUTPUT_NAME shared custom" "$<TARGET_OUTPUT_NAME:shared2>" "shared2_custom") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker custom" "$<TARGET_LINKER_OUTPUT_NAME:shared2>" "shared2_custom") -check_value ("TARGET_OUTPUT_NAME static custom" "$<TARGET_OUTPUT_NAME:static2>" "static2_custom") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker custom" "$<TARGET_LINKER_OUTPUT_NAME:static2>" "static2_custom") -]]) -if (CMAKE_C_LINKER_SUPPORTS_PDB) - string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_PDB_OUTPUT_NAME executable PDB custom" "$<TARGET_PDB_OUTPUT_NAME:exec2>" "exec2_custom") -check_value ("TARGET_PDB_OUTPUT_NAME shared PDB custom" "$<TARGET_PDB_OUTPUT_NAME:shared2>" "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" "$<TARGET_OUTPUT_NAME:exec3>" "exec3_runtime") -check_value ("TARGET_OUTPUT_NAME shared all properties" "$<TARGET_OUTPUT_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_runtime,shared3_library>") -check_value ("TARGET_LINKER_OUTPUT_NAME shared linker all properties" "$<TARGET_LINKER_OUTPUT_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_archive,shared3_library>") -check_value ("TARGET_OUTPUT_NAME static all properties" "$<TARGET_OUTPUT_NAME:static3>" "static3_archive") -check_value ("TARGET_LINKER_OUTPUT_NAME static linker all properties" "$<TARGET_LINKER_OUTPUT_NAME:static3>" "static3_archive") -]]) -if (CMAKE_C_LINKER_SUPPORTS_PDB) - string (APPEND GENERATE_CONTENT [[ -check_value ("TARGET_PDB_OUTPUT_NAME executable PDB all properties" "$<TARGET_PDB_OUTPUT_NAME:exec3>" "exec3_pdb") -check_value ("TARGET_PDB_OUTPUT_NAME shared PDB all properties" "$<TARGET_PDB_OUTPUT_NAME:shared3>" "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 $<CONFIG:${FIRST_CONFIG}>) -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_OUTPUT_NAME.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake index ba70b43..cc53bdf 100644 --- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_OUTPUT_NAME.cmake +++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake @@ -11,6 +11,6 @@ endif() file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" - CONTENT "$<TARGET_PDB_OUTPUT_NAME:empty>" + CONTENT "$<TARGET_PDB_FILE_BASE_NAME:empty>" ${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() |