diff options
author | Brad King <brad.king@kitware.com> | 2020-06-15 18:41:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-06-16 12:03:35 (GMT) |
commit | abe1c2749946a067fa71cb92ba088d3b2acabc8a (patch) | |
tree | 234a1e14845337c34aa5bb3509b331dbfc50881a /Tests/RunCMake/GenEx-TARGET_FILE | |
parent | fbead761fef491b88958ce8335c1b5aa10a99637 (diff) | |
download | CMake-abe1c2749946a067fa71cb92ba088d3b2acabc8a.zip CMake-abe1c2749946a067fa71cb92ba088d3b2acabc8a.tar.gz CMake-abe1c2749946a067fa71cb92ba088d3b2acabc8a.tar.bz2 |
Tests: Factor out RunCMake.GenEx-TARGET_FILE test
Move the `TARGET_FILE` cases and friends out of `RunCMake.GeneratorExpression`.
Diffstat (limited to 'Tests/RunCMake/GenEx-TARGET_FILE')
73 files changed, 806 insertions, 0 deletions
diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_FILE/CMakeLists.txt new file mode 100644 index 0000000..4b3de84 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt new file mode 100644 index 0000000..854447f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake:[0-9]* \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_BUNDLE_CONTENT_DIR:empty> + + TARGET_BUNDLE_CONTENT_DIR not allowed for IMPORTED targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]* \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake new file mode 100644 index 0000000..ac2d3ce --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_CONTENT_DIR.cmake @@ -0,0 +1,2 @@ +add_library(empty UNKNOWN IMPORTED) +add_custom_target(custom COMMAND echo $<TARGET_BUNDLE_CONTENT_DIR:empty>) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_DIR-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_DIR-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_DIR-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_DIR-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_DIR-stderr.txt new file mode 100644 index 0000000..9b97df1 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_DIR-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at ImportedTarget-TARGET_BUNDLE_DIR.cmake:[0-9]* \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_BUNDLE_DIR:empty> + + TARGET_BUNDLE_DIR not allowed for IMPORTED targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]* \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_DIR.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_DIR.cmake new file mode 100644 index 0000000..17c8128 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_BUNDLE_DIR.cmake @@ -0,0 +1,2 @@ +add_library(empty UNKNOWN IMPORTED) +add_custom_target(custom COMMAND echo $<TARGET_BUNDLE_DIR:empty>) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..d915ecb --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at ImportedTarget-TARGET_PDB_FILE.cmake:2 \(add_custom_target\): + Error evaluating generator expression: + + \$<TARGET_PDB_FILE:empty> + + TARGET_PDB_FILE not allowed for IMPORTED targets. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..c55c5d5 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,2 @@ +add_library(empty UNKNOWN IMPORTED) +add_custom_target(custom COMMAND echo $<TARGET_PDB_FILE:empty>) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt new file mode 100644 index 0000000..3b2a814 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/ImportedTarget-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..489d8e6 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..831edad --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidCompiler-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$<TARGET_PDB_FILE:empty> + + TARGET_PDB_FILE is not supported by the target linker. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..84a2b2e --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_PDB_FILE:empty>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME-stderr.txt new file mode 100644 index 0000000..b061ce3 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidCompiler-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..811c3f7 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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 "[$<TARGET_PDB_FILE_BASE_NAME:empty>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt new file mode 100644 index 0000000..03c02d9 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake:[0-9]* \(file\): + Error evaluating generator expression: + + \$<TARGET_BUNDLE_CONTENT_DIR:empty> + + TARGET_BUNDLE_CONTENT_DIR is allowed only for Bundle targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]* \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake new file mode 100644 index 0000000..63b3b1b --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_CONTENT_DIR.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_BUNDLE_CONTENT_DIR:empty>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_DIR-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_DIR-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_DIR-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_DIR-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_DIR-stderr.txt new file mode 100644 index 0000000..f895c88 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_DIR-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidTarget-TARGET_BUNDLE_DIR.cmake:[0-9]* \(file\): + Error evaluating generator expression: + + \$<TARGET_BUNDLE_DIR:empty> + + TARGET_BUNDLE_DIR is allowed only for Bundle targets. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]* \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_DIR.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_DIR.cmake new file mode 100644 index 0000000..19f333a --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_BUNDLE_DIR.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_BUNDLE_DIR:empty>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE-stderr.txt new file mode 100644 index 0000000..e5f21e2 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at NonValidTarget-TARGET_PDB_FILE.cmake:6 \(file\): + Error evaluating generator expression: + + \$<TARGET_PDB_FILE:empty> + + TARGET_PDB_FILE is allowed only for targets with linker created artifacts. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..84a2b2e --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,9 @@ + +enable_language(C) + +add_library(empty STATIC empty.c) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_PDB_FILE:empty>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE_BASE_NAME-stderr.txt new file mode 100644 index 0000000..c7d245c --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/NonValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..811c3f7 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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 "[$<TARGET_PDB_FILE_BASE_NAME:empty>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion-stderr.txt new file mode 100644 index 0000000..013c4f2 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion-stderr.txt @@ -0,0 +1,10 @@ +CMake Error at OUTPUT_NAME-recursion.cmake:[0-9]+ \(add_executable\): + Target 'empty2' OUTPUT_NAME depends on itself. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Error at OUTPUT_NAME-recursion.cmake:[0-9]+ \(add_executable\): + Target 'empty2' OUTPUT_NAME depends on itself. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion.cmake new file mode 100644 index 0000000..006b0da --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/OUTPUT_NAME-recursion.cmake @@ -0,0 +1,6 @@ +enable_language(C) +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_FILE_BASE_NAME:empty2>) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake new file mode 100644 index 0000000..ccec633 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/RunCMakeTest.cmake @@ -0,0 +1,31 @@ +include(RunCMake) + +run_cmake(TARGET_FILE-recursion) +run_cmake(OUTPUT_NAME-recursion) +run_cmake(TARGET_FILE_PREFIX) +run_cmake(TARGET_FILE_PREFIX-imported-target) +run_cmake(TARGET_FILE_PREFIX-non-valid-target) +run_cmake(TARGET_LINKER_FILE_PREFIX-non-valid-target) +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_with_options(TARGET_FILE_BASE_NAME -DCMAKE_BUILD_TYPE:STRING=Debug) +run_cmake_with_options(TARGET_FILE_BASE_NAME-imported-target -DCMAKE_BUILD_TYPE:STRING=Debug) +run_cmake(TARGET_FILE_BASE_NAME-non-valid-target) +run_cmake(TARGET_LINKER_FILE_BASE_NAME-non-valid-target) +run_cmake(NonValidTarget-TARGET_BUNDLE_DIR) +run_cmake(NonValidTarget-TARGET_BUNDLE_CONTENT_DIR) +run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) +run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR) +run_cmake(ImportedTarget-TARGET_PDB_FILE) +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_FILE_BASE_NAME) + run_cmake(ValidTarget-TARGET_PDB_FILE_BASE_NAME) +else() + run_cmake(NonValidCompiler-TARGET_PDB_FILE) + run_cmake(NonValidCompiler-TARGET_PDB_FILE_BASE_NAME) +endif() diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE-recursion-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE-recursion-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE-recursion-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE-recursion-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE-recursion-stderr.txt new file mode 100644 index 0000000..5b15526 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE-recursion-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at TARGET_FILE-recursion.cmake:[0-9]+ \(add_executable\): + Target 'empty1' OUTPUT_DIRECTORY depends on itself. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE-recursion.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE-recursion.cmake new file mode 100644 index 0000000..e780103 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE-recursion.cmake @@ -0,0 +1,4 @@ +enable_language(C) +add_executable(empty1 empty.c) +set_property(TARGET empty1 PROPERTY OUTPUT_NAME $<TARGET_FILE_NAME:empty1>) +set_property(TARGET empty1 PROPERTY RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:empty1>) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-check.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-check.cmake new file mode 100644 index 0000000..793edb1 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target-check.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target-check.cmake new file mode 100644 index 0000000..793edb1 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target.cmake new file mode 100644 index 0000000..40f7c66 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target.cmake @@ -0,0 +1,106 @@ + +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" "$<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") +]]) + + +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" "$<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") +]]) + + +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) +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) +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) + +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") +]]) + + +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}>) +else() + set (FIRST_CONFIG ${CMAKE_BUILD_TYPE}) +endif() +string (TOUPPER "${FIRST_CONFIG}" FIRST_CONFIG) + + +add_executable (exec4 IMPORTED) +set_property (TARGET exec4 PROPERTY RUNTIME_OUTPUT_NAME exec4_runtime) +set_property (TARGET exec4 PROPERTY LIBRARY_OUTPUT_NAME exec4_library) +set_property (TARGET exec4 PROPERTY ARCHIVE_OUTPUT_NAME exec4_archive) +set_property (TARGET exec4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) +add_library (shared4 SHARED IMPORTED) +set_property (TARGET shared4 PROPERTY RUNTIME_OUTPUT_NAME shared4_runtime) +set_property (TARGET shared4 PROPERTY LIBRARY_OUTPUT_NAME shared4_library) +set_property (TARGET shared4 PROPERTY ARCHIVE_OUTPUT_NAME shared4_archive) +set_property (TARGET shared4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) +add_library (static4 STATIC IMPORTED) +set_property (TARGET static4 PROPERTY RUNTIME_OUTPUT_NAME static4_runtime) +set_property (TARGET static4 PROPERTY LIBRARY_OUTPUT_NAME static4_library) +set_property (TARGET static4 PROPERTY ARCHIVE_OUTPUT_NAME static4_archive) +set_property (TARGET static4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable all properties + postfix" "$<TARGET_FILE_BASE_NAME:exec4>" "exec4_runtime_postfix") +check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_runtime,shared4_library>_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_archive,shared4_library>_postfix") +check_value ("TARGET_FILE_BASE_NAME static all properties + postfix" "$<TARGET_FILE_BASE_NAME:static4>" "static4_archive_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:static4>" "static4_archive_postfix") +]]) + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake" + CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-non-valid-target-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-non-valid-target-stderr.txt new file mode 100644 index 0000000..ecb9e5d --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-non-valid-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-non-valid-target.cmake new file mode 100644 index 0000000..8622b7d --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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 "[$<TARGET_FILE_BASE_NAME:empty>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..f88d710 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake @@ -0,0 +1,135 @@ + +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}>) +else() + set (FIRST_CONFIG ${CMAKE_BUILD_TYPE}) +endif() +string (TOUPPER "${FIRST_CONFIG}" FIRST_CONFIG) + + +add_executable (exec4 empty.c) +set_property (TARGET exec4 PROPERTY RUNTIME_OUTPUT_NAME exec4_runtime) +set_property (TARGET exec4 PROPERTY LIBRARY_OUTPUT_NAME exec4_library) +set_property (TARGET exec4 PROPERTY ARCHIVE_OUTPUT_NAME exec4_archive) +set_property (TARGET exec4 PROPERTY PDB_NAME exec4_pdb) +set_property (TARGET exec4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) +add_library (shared4 SHARED empty.c) +set_property (TARGET shared4 PROPERTY RUNTIME_OUTPUT_NAME shared4_runtime) +set_property (TARGET shared4 PROPERTY LIBRARY_OUTPUT_NAME shared4_library) +set_property (TARGET shared4 PROPERTY ARCHIVE_OUTPUT_NAME shared4_archive) +set_property (TARGET shared4 PROPERTY PDB_NAME shared4_pdb) +set_property (TARGET shared4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) +add_library (static4 STATIC empty.c) +set_property (TARGET static4 PROPERTY RUNTIME_OUTPUT_NAME static4_runtime) +set_property (TARGET static4 PROPERTY LIBRARY_OUTPUT_NAME static4_library) +set_property (TARGET static4 PROPERTY ARCHIVE_OUTPUT_NAME static4_archive) +set_property (TARGET static4 PROPERTY PDB_NAME static4_pdb) +set_property (TARGET static4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) + +string (APPEND GENERATE_CONTENT [[ + +check_value ("TARGET_FILE_BASE_NAME executable all properties + postfix" "$<TARGET_FILE_BASE_NAME:exec4>" "exec4_runtime_postfix") +check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_runtime,shared4_library>_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_archive,shared4_library>_postfix") +check_value ("TARGET_FILE_BASE_NAME static all properties + postfix" "$<TARGET_FILE_BASE_NAME:static4>" "static4_archive_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:static4>" "static4_archive_postfix") +]]) +if (CMAKE_C_LINKER_SUPPORTS_PDB) + string (APPEND GENERATE_CONTENT [[ +check_value ("TARGET_PDB_FILE_BASE_NAME executable PDB all properties + postfix" "$<TARGET_PDB_FILE_BASE_NAME:exec4>" "exec4_pdb_postfix") +check_value ("TARGET_PDB_FILE_BASE_NAME shared PDB all properties + postfix" "$<TARGET_PDB_FILE_BASE_NAME:shared4>" "shared4_pdb_postfix") +]]) +endif() + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_BASE_NAME-generated.cmake" + CONTENT "${GENERATE_CONTENT}" ${GENERATE_CONDITION}) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-check.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-check.cmake new file mode 100644 index 0000000..676ad4b --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_PREFIX-generated.cmake") diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target-check.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target-check.cmake new file mode 100644 index 0000000..676ad4b --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_PREFIX-generated.cmake") diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target.cmake new file mode 100644 index 0000000..f52776e --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target.cmake @@ -0,0 +1,49 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (win_platforms Windows CYGWIN) + +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 +"\ncheck_value (\"TARGET_FILE_PREFIX executable default\" \"$<TARGET_FILE_PREFIX:exec1>\" \"\") +check_value (\"TARGET_FILE_PREFIX shared default\" \"$<TARGET_FILE_PREFIX:shared1>\" \"${CMAKE_SHARED_LIBRARY_PREFIX}\") +check_value (\"TARGET_LINKER_FILE_PREFIX shared linker default\" \"$<TARGET_LINKER_FILE_PREFIX:shared1>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_PREFIX},${CMAKE_SHARED_LIBRARY_PREFIX}>\") +check_value (\"TARGET_FILE_PREFIX static default\" \"$<TARGET_FILE_PREFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_PREFIX}\") +check_value (\"TARGET_LINKER_FILE_PREFIX static linker default\" \"$<TARGET_LINKER_FILE_PREFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_PREFIX}\")\n") + + +add_executable (exec2 IMPORTED) +set_property (TARGET exec2 PROPERTY PREFIX exec2_prefix) +set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET exec2 PROPERTY IMPORT_PREFIX exec2_import_prefix) +add_library (shared2 SHARED IMPORTED) +set_property (TARGET shared2 PROPERTY PREFIX shared2_prefix) +set_property (TARGET shared2 PROPERTY IMPORT_PREFIX shared2_import_prefix) +add_library (static2 STATIC IMPORTED) +set_property (TARGET static2 PROPERTY PREFIX static2_prefix) +set_property (TARGET static2 PROPERTY IMPORT_PREFIX static2_import_prefix) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_PREFIX executable custom\" \"$<TARGET_FILE_PREFIX:exec2>\" \"exec2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX executable linker custom\" \"$<TARGET_LINKER_FILE_PREFIX:exec2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms};AIX>,exec2_import_prefix,exec2_prefix>\") +check_value (\"TARGET_FILE_PREFIX shared custom\" \"$<TARGET_FILE_PREFIX:shared2>\" \"shared2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX shared linker custom\" \"$<TARGET_LINKER_FILE_PREFIX:shared2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,shared2_import_prefix,shared2_prefix>\") +check_value (\"TARGET_FILE_PREFIX static custom\" \"$<TARGET_FILE_PREFIX:static2>\" \"static2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX static linker custom\" \"$<TARGET_LINKER_FILE_PREFIX:static2>\" \"static2_prefix\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_PREFIX-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-non-valid-target-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-non-valid-target-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-non-valid-target-stderr.txt new file mode 100644 index 0000000..81362ef --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_FILE_PREFIX-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_FILE_PREFIX:empty> + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-non-valid-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-non-valid-target.cmake new file mode 100644 index 0000000..d1095fa --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-non-valid-target.cmake @@ -0,0 +1,7 @@ + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_FILE_PREFIX:empty>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX.cmake new file mode 100644 index 0000000..bef7bbf --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX.cmake @@ -0,0 +1,49 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (win_platforms Windows CYGWIN) + +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 +"\ncheck_value (\"TARGET_FILE_PREFIX executable default\" \"$<TARGET_FILE_PREFIX:exec1>\" \"\") +check_value (\"TARGET_FILE_PREFIX shared default\" \"$<TARGET_FILE_PREFIX:shared1>\" \"${CMAKE_SHARED_LIBRARY_PREFIX}\") +check_value (\"TARGET_LINKER_FILE_PREFIX shared linker default\" \"$<TARGET_LINKER_FILE_PREFIX:shared1>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_PREFIX},${CMAKE_SHARED_LIBRARY_PREFIX}>\") +check_value (\"TARGET_FILE_PREFIX static default\" \"$<TARGET_FILE_PREFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_PREFIX}\") +check_value (\"TARGET_LINKER_FILE_PREFIX static linker default\" \"$<TARGET_LINKER_FILE_PREFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_PREFIX}\")\n") + + +add_executable (exec2 empty.c) +set_property (TARGET exec2 PROPERTY PREFIX exec2_prefix) +set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET exec2 PROPERTY IMPORT_PREFIX exec2_import_prefix) +add_library (shared2 SHARED empty.c) +set_property (TARGET shared2 PROPERTY PREFIX shared2_prefix) +set_property (TARGET shared2 PROPERTY IMPORT_PREFIX shared2_import_prefix) +add_library (static2 STATIC empty.c) +set_property (TARGET static2 PROPERTY PREFIX static2_prefix) +set_property (TARGET static2 PROPERTY IMPORT_PREFIX static2_import_prefix) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_PREFIX executable custom\" \"$<TARGET_FILE_PREFIX:exec2>\" \"exec2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX executable linker custom\" \"$<TARGET_LINKER_FILE_PREFIX:exec2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms};AIX>,exec2_import_prefix,exec2_prefix>\") +check_value (\"TARGET_FILE_PREFIX shared custom\" \"$<TARGET_FILE_PREFIX:shared2>\" \"shared2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX shared linker custom\" \"$<TARGET_LINKER_FILE_PREFIX:shared2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,shared2_import_prefix,shared2_prefix>\") +check_value (\"TARGET_FILE_PREFIX static custom\" \"$<TARGET_FILE_PREFIX:static2>\" \"static2_prefix\") +check_value (\"TARGET_LINKER_FILE_PREFIX static linker custom\" \"$<TARGET_LINKER_FILE_PREFIX:static2>\" \"static2_prefix\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_PREFIX-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-check.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-check.cmake new file mode 100644 index 0000000..f159370 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake") diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target-check.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target-check.cmake new file mode 100644 index 0000000..f159370 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target-check.cmake @@ -0,0 +1,2 @@ + +include ("${RunCMake_TEST_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake") diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake new file mode 100644 index 0000000..cefeb86 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake @@ -0,0 +1,49 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (win_platforms Windows CYGWIN) + +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 +"\ncheck_value (\"TARGET_FILE_SUFFIX executable default\" \"$<TARGET_FILE_SUFFIX:exec1>\" \"${CMAKE_EXECUTABLE_SUFFIX}\") +check_value (\"TARGET_FILE_SUFFIX shared default\" \"$<TARGET_FILE_SUFFIX:shared1>\" \"${CMAKE_SHARED_LIBRARY_SUFFIX}\") +check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker default\" \"$<TARGET_LINKER_FILE_SUFFIX:shared1>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_SUFFIX},${CMAKE_SHARED_LIBRARY_SUFFIX}>\") +check_value (\"TARGET_FILE_SUFFIX static default\" \"$<TARGET_FILE_SUFFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\") +check_value (\"TARGET_LINKER_FILE_SUFFIX static linker default\" \"$<TARGET_LINKER_FILE_SUFFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\")\n") + + +add_executable (exec2 IMPORTED) +set_property (TARGET exec2 PROPERTY SUFFIX exec2_suffix) +set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET exec2 PROPERTY IMPORT_SUFFIX exec2_import_suffix) +add_library (shared2 SHARED IMPORTED) +set_property (TARGET shared2 PROPERTY SUFFIX shared2_suffix) +set_property (TARGET shared2 PROPERTY IMPORT_SUFFIX shared2_import_suffix) +add_library (static2 STATIC IMPORTED) +set_property (TARGET static2 PROPERTY SUFFIX static2_suffix) +set_property (TARGET static2 PROPERTY IMPORT_SUFFIX static2_import_suffix) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_SUFFIX executable custom\" \"$<TARGET_FILE_SUFFIX:exec2>\" \"exec2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX executable linker custom\" \"$<TARGET_LINKER_FILE_SUFFIX:exec2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms};AIX>,exec2_import_suffix,exec2_suffix>\") +check_value (\"TARGET_FILE_SUFFIX shared custom\" \"$<TARGET_FILE_SUFFIX:shared2>\" \"shared2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker custom\" \"$<TARGET_LINKER_FILE_SUFFIX:shared2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,shared2_import_suffix,shared2_suffix>\") +check_value (\"TARGET_FILE_SUFFIX static custom\" \"$<TARGET_FILE_SUFFIX:static2>\" \"static2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX static linker custom\" \"$<TARGET_LINKER_FILE_SUFFIX:static2>\" \"static2_suffix\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-non-valid-target-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-non-valid-target-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-non-valid-target-stderr.txt new file mode 100644 index 0000000..9ea09d1 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_FILE_SUFFIX-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_FILE_SUFFIX:empty> + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-non-valid-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-non-valid-target.cmake new file mode 100644 index 0000000..f7089f9 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-non-valid-target.cmake @@ -0,0 +1,7 @@ + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_FILE_SUFFIX:empty>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake new file mode 100644 index 0000000..39e39fd --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake @@ -0,0 +1,49 @@ + +cmake_minimum_required(VERSION 3.14) + +enable_language (C) + +set (win_platforms Windows CYGWIN) + +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 +"\ncheck_value (\"TARGET_FILE_SUFFIX executable default\" \"$<TARGET_FILE_SUFFIX:exec1>\" \"${CMAKE_EXECUTABLE_SUFFIX}\") +check_value (\"TARGET_FILE_SUFFIX shared default\" \"$<TARGET_FILE_SUFFIX:shared1>\" \"${CMAKE_SHARED_LIBRARY_SUFFIX}\") +check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker default\" \"$<TARGET_LINKER_FILE_SUFFIX:shared1>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_SUFFIX},${CMAKE_SHARED_LIBRARY_SUFFIX}>\") +check_value (\"TARGET_FILE_SUFFIX static default\" \"$<TARGET_FILE_SUFFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\") +check_value (\"TARGET_LINKER_FILE_SUFFIX static linker default\" \"$<TARGET_LINKER_FILE_SUFFIX:static1>\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\")\n") + + +add_executable (exec2 empty.c) +set_property (TARGET exec2 PROPERTY SUFFIX exec2_suffix) +set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) +set_property (TARGET exec2 PROPERTY IMPORT_SUFFIX exec2_import_suffix) +add_library (shared2 SHARED empty.c) +set_property (TARGET shared2 PROPERTY SUFFIX shared2_suffix) +set_property (TARGET shared2 PROPERTY IMPORT_SUFFIX shared2_import_suffix) +add_library (static2 STATIC empty.c) +set_property (TARGET static2 PROPERTY SUFFIX static2_suffix) +set_property (TARGET static2 PROPERTY IMPORT_SUFFIX static2_import_suffix) + +string (APPEND GENERATE_CONTENT +"\ncheck_value (\"TARGET_FILE_SUFFIX executable custom\" \"$<TARGET_FILE_SUFFIX:exec2>\" \"exec2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX executable linker custom\" \"$<TARGET_LINKER_FILE_SUFFIX:exec2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms};AIX>,exec2_import_suffix,exec2_suffix>\") +check_value (\"TARGET_FILE_SUFFIX shared custom\" \"$<TARGET_FILE_SUFFIX:shared2>\" \"shared2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker custom\" \"$<TARGET_LINKER_FILE_SUFFIX:shared2>\" \"$<IF:$<IN_LIST:$<PLATFORM_ID>,${win_platforms}>,shared2_import_suffix,shared2_suffix>\") +check_value (\"TARGET_FILE_SUFFIX static custom\" \"$<TARGET_FILE_SUFFIX:static2>\" \"static2_suffix\") +check_value (\"TARGET_LINKER_FILE_SUFFIX static linker custom\" \"$<TARGET_LINKER_FILE_SUFFIX:static2>\" \"static2_suffix\")\n") + + +file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake" + CONTENT "${GENERATE_CONTENT}") diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_BASE_NAME-non-valid-target-stderr.txt new file mode 100644 index 0000000..1ae2f2c --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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/GenEx-TARGET_FILE/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_BASE_NAME-non-valid-target.cmake new file mode 100644 index 0000000..776fb4b --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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 "[$<TARGET_LINKER_FILE_BASE_NAME:empty>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_PREFIX-non-valid-target-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_PREFIX-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_PREFIX-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_PREFIX-non-valid-target-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_PREFIX-non-valid-target-stderr.txt new file mode 100644 index 0000000..7a36cef --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_PREFIX-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_LINKER_FILE_PREFIX:empty> + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake new file mode 100644 index 0000000..8dad4da --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_PREFIX-non-valid-target.cmake @@ -0,0 +1,7 @@ + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_LINKER_FILE_PREFIX:empty>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_SUFFIX-non-valid-target-result.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_SUFFIX-non-valid-target-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_SUFFIX-non-valid-target-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_SUFFIX-non-valid-target-stderr.txt b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_SUFFIX-non-valid-target-stderr.txt new file mode 100644 index 0000000..cc5217a --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_SUFFIX-non-valid-target-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<TARGET_LINKER_FILE_SUFFIX:empty> + + Target "empty" is not an executable or library\. diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake new file mode 100644 index 0000000..82c2f3a --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_LINKER_FILE_SUFFIX-non-valid-target.cmake @@ -0,0 +1,7 @@ + +add_custom_target(empty) + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "[$<TARGET_LINKER_FILE_SUFFIX:empty>]" +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ValidTarget-TARGET_PDB_FILE-check.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/ValidTarget-TARGET_PDB_FILE-check.cmake new file mode 100644 index 0000000..2a588bc --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/ValidTarget-TARGET_PDB_FILE-check.cmake @@ -0,0 +1,17 @@ +file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT ENCODING UTF-8) + +list(GET TEST_TXT 0 PDB_PATH) +list(GET TEST_TXT 1 PDB_NAME) +list(GET TEST_TXT 2 PDB_DIR) + +if(NOT PDB_PATH MATCHES "empty\\.pdb") + message(FATAL_ERROR "unexpected PDB_PATH [${PDB_PATH}]") +endif() + +if(NOT PDB_NAME STREQUAL "empty.pdb") + message(FATAL_ERROR "unexpected PDB_NAME [${PDB_NAME}]") +endif() + +if(PDB_DIR MATCHES "empty\\.pdb") + message(FATAL_ERROR "unexpected PDB_DIR [${PDB_DIR}]") +endif() diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ValidTarget-TARGET_PDB_FILE.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/ValidTarget-TARGET_PDB_FILE.cmake new file mode 100644 index 0000000..a66394b --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/ValidTarget-TARGET_PDB_FILE.cmake @@ -0,0 +1,20 @@ + +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 $<CONFIG:${FIRST_CONFIG}>) +endif() + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT +[[$<TARGET_PDB_FILE:empty> +$<TARGET_PDB_FILE_NAME:empty> +$<TARGET_PDB_FILE_DIR:empty> +]] + ${GENERATE_CONDITION} +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/ValidTarget-TARGET_PDB_FILE_BASE_NAME-check.cmake new file mode 100644 index 0000000..996d2d4 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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/GenEx-TARGET_FILE/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/ValidTarget-TARGET_PDB_FILE_BASE_NAME.cmake new file mode 100644 index 0000000..cc53bdf --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/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 $<CONFIG:${FIRST_CONFIG}>) +endif() + +file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test.txt" + CONTENT "$<TARGET_PDB_FILE_BASE_NAME:empty>" + ${GENERATE_CONDITION} +) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/empty.c b/Tests/RunCMake/GenEx-TARGET_FILE/empty.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/GenEx-TARGET_FILE/empty.c |