Skip to content

Commit aa30403

Browse files
committed
Append output directory to existing ones
1 parent 723d4b5 commit aa30403

4 files changed

Lines changed: 46 additions & 14 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ include("${RED4EXT_CMAKE_DIR}/ConfigureDefaultOutputDirectories.cmake")
1414
include("${RED4EXT_CMAKE_DIR}/ConfigureResourceRc.cmake")
1515
include("${RED4EXT_CMAKE_DIR}/ConfigureVersionFile.cmake")
1616
include("${RED4EXT_CMAKE_DIR}/ConfigureVersionFromGit.cmake")
17-
include("${RED4EXT_CMAKE_DIR}/TargetOutputDirectory.cmake")
17+
include("${RED4EXT_CMAKE_DIR}/TargetAppendOutputDirectory.cmake")
1818

1919
# ------------------------------------------------------------------------------
2020
# Versioning
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
function(red4ext_target_append_output_directory TARGET DIRECTORY)
2+
foreach(CONFIGURATION ${CMAKE_CONFIGURATION_TYPES})
3+
string(TOUPPER ${CONFIGURATION} CONFIGURATION_UPPER)
4+
5+
get_target_property(
6+
CURRENT_ARCHIVE_OUTPUT_DIRECTORY
7+
${TARGET}
8+
"${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONFIGURATION_UPPER}}"
9+
)
10+
if(CURRENT_ARCHIVE_OUTPUT_DIRECTORY)
11+
set_target_properties(
12+
${TARGET}
13+
PROPERTIES
14+
ARCHIVE_OUTPUT_DIRECTORY_${CONFIGURATION_UPPER} "${CURRENT_ARCHIVE_OUTPUT_DIRECTORY}/${DIRECTORY}"
15+
)
16+
endif()
17+
18+
get_target_property(
19+
CURRENT_LIBRARY_OUTPUT_DIRECTORY
20+
${TARGET}
21+
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONFIGURATION_UPPER}}"
22+
)
23+
if(CURRENT_LIBRARY_OUTPUT_DIRECTORY)
24+
set_target_properties(
25+
${TARGET}
26+
PROPERTIES
27+
LIBRARY_OUTPUT_DIRECTORY_${CONFIGURATION_UPPER} "${CURRENT_LIBRARY_OUTPUT_DIRECTORY}/${DIRECTORY}"
28+
)
29+
endif()
30+
31+
get_target_property(
32+
CURRENT_RUNTIME_OUTPUT_DIRECTORY
33+
${TARGET}
34+
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIGURATION_UPPER}}"
35+
)
36+
if(CURRENT_RUNTIME_OUTPUT_DIRECTORY)
37+
set_target_properties(
38+
${TARGET}
39+
PROPERTIES
40+
RUNTIME_OUTPUT_DIRECTORY_${CONFIGURATION_UPPER} "${CURRENT_RUNTIME_OUTPUT_DIRECTORY}/${DIRECTORY}"
41+
)
42+
endif()
43+
endforeach()
44+
endfunction()

cmake/TargetOutputDirectory.cmake

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/playground/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
add_library(RED4ext.Playground SHARED)
22

3-
red4ext_target_output_directory(
3+
red4ext_target_append_output_directory(
44
RED4ext.Playground
55
plugins
66
)

0 commit comments

Comments
 (0)