diff options
author | Asit Dhal <dhal.asitk@gmail.com> | 2021-01-11 17:14:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-01-26 17:13:15 (GMT) |
commit | 64c3857780e7b7595e0ce96e1081dcda835910b1 (patch) | |
tree | 1ef823ef06aaf9221b1a20e2ae37387481c8c7d1 /Tests/RunCMake/ArtifactOutputDirs/ArtifactOutputDirs.cmake | |
parent | 72974fe3392630c3df7805c9ec641898b7dd128b (diff) | |
download | CMake-64c3857780e7b7595e0ce96e1081dcda835910b1.zip CMake-64c3857780e7b7595e0ce96e1081dcda835910b1.tar.gz CMake-64c3857780e7b7595e0ce96e1081dcda835910b1.tar.bz2 |
OUTPUT_DIRECTORY: Support tgt genex in output artifact vars
Following variables now support target dependent generator expressions.
- CMAKE_RUNTIME_OUTPUT_DIRECTORY
- CMAKE_LIBRARY_OUTPUT_DIRECTORY
- CMAKE_ARCHIVE_OUTPUT_DIRECTORY
Fixes: #18055
Diffstat (limited to 'Tests/RunCMake/ArtifactOutputDirs/ArtifactOutputDirs.cmake')
-rw-r--r-- | Tests/RunCMake/ArtifactOutputDirs/ArtifactOutputDirs.cmake | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/ArtifactOutputDirs/ArtifactOutputDirs.cmake b/Tests/RunCMake/ArtifactOutputDirs/ArtifactOutputDirs.cmake new file mode 100644 index 0000000..d0accd7 --- /dev/null +++ b/Tests/RunCMake/ArtifactOutputDirs/ArtifactOutputDirs.cmake @@ -0,0 +1,27 @@ +enable_language(C) + +if(CMAKE_IMPORT_LIBRARY_SUFFIX) + set(expect_dll 1) +else() + set(expect_dll 0) +endif() + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/$<IF:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>,rtlib,rtbin>") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/$<IF:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>,sharedlib,others>") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/$<IF:$<STREQUAL:$<TARGET_PROPERTY:TYPE>,STATIC_LIBRARY>,staticlib,others>") + +add_executable(exe_tgt main.c) +add_library(shared_tgt SHARED lib.c) +add_library(static_tgt STATIC lib.c) + +add_custom_target(checkDirs ALL + COMMAND ${CMAKE_COMMAND} + -Dartifact_path=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG> + -Dexe_name=$<TARGET_FILE_NAME:exe_tgt> + -Dshared_name=$<TARGET_FILE_NAME:shared_tgt> + -Dstatic_name=$<TARGET_FILE_NAME:static_tgt> + -Dexpect_dll=${expect_dll} + -P ${CMAKE_CURRENT_SOURCE_DIR}/check.cmake + ) + +add_dependencies(checkDirs exe_tgt shared_tgt static_tgt) |