summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/GeneratorExpression
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2019-04-25 16:48:43 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2019-05-02 09:01:10 (GMT)
commit6e5ccabe9ba1b92bb5244683c4315964b01e0df7 (patch)
treeb1c4c1fb7c20689d8c3865b72800b1e868a1e6fd /Tests/RunCMake/GeneratorExpression
parent1f4c9aa7d2c93f2377a6d1cb4cf2c1137466e927 (diff)
downloadCMake-6e5ccabe9ba1b92bb5244683c4315964b01e0df7.zip
CMake-6e5ccabe9ba1b92bb5244683c4315964b01e0df7.tar.gz
CMake-6e5ccabe9ba1b92bb5244683c4315964b01e0df7.tar.bz2
Genex: Update $<TARGET_FILE_BASE_NAME:...>: take care of POSTFIX
This capability complement MR !3190 and !3207 and is also needed to solve issue #18771.
Diffstat (limited to 'Tests/RunCMake/GeneratorExpression')
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake33
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake39
3 files changed, 71 insertions, 5 deletions
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 477b593..a491e99 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -41,8 +41,8 @@ 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_FILE_BASE_NAME)
-run_cmake(TARGET_FILE_BASE_NAME-imported-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(TARGET_PROPERTY-LOCATION)
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake
index aa54b31..40f7c66 100644
--- a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME-imported-target.cmake
@@ -46,17 +46,14 @@ add_executable (exec3 IMPORTED)
set_property (TARGET exec3 PROPERTY RUNTIME_OUTPUT_NAME exec3_runtime)
set_property (TARGET exec3 PROPERTY LIBRARY_OUTPUT_NAME exec3_library)
set_property (TARGET exec3 PROPERTY ARCHIVE_OUTPUT_NAME exec3_archive)
-set_property (TARGET exec3 PROPERTY PDB_NAME exec3_pdb)
add_library (shared3 SHARED IMPORTED)
set_property (TARGET shared3 PROPERTY RUNTIME_OUTPUT_NAME shared3_runtime)
set_property (TARGET shared3 PROPERTY LIBRARY_OUTPUT_NAME shared3_library)
set_property (TARGET shared3 PROPERTY ARCHIVE_OUTPUT_NAME shared3_archive)
-set_property (TARGET shared3 PROPERTY PDB_NAME shared3_pdb)
add_library (static3 STATIC IMPORTED)
set_property (TARGET static3 PROPERTY RUNTIME_OUTPUT_NAME static3_runtime)
set_property (TARGET static3 PROPERTY LIBRARY_OUTPUT_NAME static3_library)
set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive)
-set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb)
string (APPEND GENERATE_CONTENT [[
@@ -73,7 +70,37 @@ 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/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake
index 5ea53a0..f88d710 100644
--- a/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_FILE_BASE_NAME.cmake
@@ -90,7 +90,46 @@ 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})