summaryrefslogtreecommitdiffstats
path: root/Utilities/File2Include
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-01-25 06:16:18 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-01-25 06:16:18 +0000
commitbf7c0e9ffce3e9eba99310bc81c3e37b2e21ad6b (patch)
tree9c6370ca0f31de758ad8253b8ab9c2c9ab07f96b /Utilities/File2Include
parentAdded comments re object ownership in Core Foundation lib (diff)
downloadDiligentCore-bf7c0e9ffce3e9eba99310bc81c3e37b2e21ad6b.tar.gz
DiligentCore-bf7c0e9ffce3e9eba99310bc81c3e37b2e21ad6b.zip
Updated build rules for File2String to avoid issues with clean build command
Diffstat (limited to 'Utilities/File2Include')
-rw-r--r--Utilities/File2Include/CMakeLists.txt22
1 files changed, 13 insertions, 9 deletions
diff --git a/Utilities/File2Include/CMakeLists.txt b/Utilities/File2Include/CMakeLists.txt
index 800be39e..6e873ce0 100644
--- a/Utilities/File2Include/CMakeLists.txt
+++ b/Utilities/File2Include/CMakeLists.txt
@@ -19,17 +19,11 @@ if(PLATFORM_WIN32 OR PLATFORM_LINUX OR PLATFORM_MACOS)
target_compile_options(File2String PRIVATE "$<$<CONFIG:MINSIZEREL>:${MSVC_REL_COMPILE_OPTIONS}>")
target_compile_options(File2String PRIVATE "$<$<CONFIG:RELWITHDEBINFO>:${MSVC_REL_COMPILE_OPTIONS}>")
endif()
- set_target_properties(File2String PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/bin/Win32/x${ARCH}"
- )
+ set(DST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bin/Win32/x${ARCH}/")
elseif(PLATFORM_LINUX)
- set_target_properties(File2String PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/bin/Linux"
- )
+ set(DST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bin/Linux/")
elseif(PLATFORM_MACOS)
- set_target_properties(File2String PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/bin/MacOS"
- )
+ set(DST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bin/MacOS/")
target_compile_features(File2String PRIVATE cxx_std_11)
endif()
source_group("source" FILES ${SOURCE})
@@ -37,6 +31,16 @@ if(PLATFORM_WIN32 OR PLATFORM_LINUX OR PLATFORM_MACOS)
set_target_properties(File2String PROPERTIES
FOLDER Utilities
)
+
+ # When setting RUNTIME_OUTPUT_DIRECTORY_RELEASE to DST_DIR,
+ # the executable is deleted by the clean build command
+ add_custom_command(TARGET File2String POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "\"$<TARGET_FILE:File2String>\""
+ # In release build, copy to the destination folder
+ # In all other configurations, do nothing by copying to the same target folder
+ $<IF:$<CONFIG:RELEASE>,${DST_DIR},$<TARGET_FILE_DIR:File2String>>
+ )
endif()
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")