summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-10-17 00:12:27 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-10-17 00:12:27 +0200
commit07ae849c48de49b2644e78fa02fda63275104164 (patch)
tree1c4c5abc01648280d45f33a5b107b1dd36afa4a8
parenta4a9c191018ad225d36665eaf33f9dbff27514c4 (diff)
cmake: fix constantly relinking
-rw-r--r--CMakeLists.txt9
-rw-r--r--anim-crop-tool/CMakeLists.txt2
-rw-r--r--bench/CMakeLists.txt3
-rw-r--r--editor/CMakeLists.txt3
-rw-r--r--test/CMakeLists.txt3
5 files changed, 9 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f565e959..a6754fae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -213,7 +213,7 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
add_compile_options(-Wno-subobject-linkage -Wno-parentheses -Wno-overloaded-virtual)
endif()
-function(fm_add_debug_info self)
+function(fm_add_install_executable self)
if(NOT MSVC AND NOT APPLE)
if(CMAKE_RUNTIME_OUTPUT_DIRECTORY STREQUAL "")
message(FATAL_ERROR "")
@@ -224,12 +224,13 @@ function(fm_add_debug_info self)
set(exe "${self}${CMAKE_EXECUTABLE_SUFFIX}")
add_custom_command(TARGET ${self} POST_BUILD
COMMAND "${CMAKE_OBJCOPY}" --only-keep-debug "${exe}" "${exe}.debug"
- COMMAND "${CMAKE_OBJCOPY}" --strip-all "${exe}"
- COMMAND "${CMAKE_OBJCOPY}" --add-gnu-debuglink=${exe}.debug "${exe}"
- BYPRODUCTS "${exe}.debug"
+ COMMAND "${CMAKE_OBJCOPY}" --strip-all "${exe}" "${exe}.nodebug"
+ COMMAND "${CMAKE_OBJCOPY}" --add-gnu-debuglink=${exe}.debug "${exe}.nodebug"
+ # BYPRODUCTS "${exe}.debug" "${exe}.nodebug"
WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
)
install(FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${exe}.debug" DESTINATION bin)
+ install(FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${exe}.nodebug" RENAME "${exe}" DESTINATION bin)
endif()
endfunction()
diff --git a/anim-crop-tool/CMakeLists.txt b/anim-crop-tool/CMakeLists.txt
index 91b3c1b0..9fd5f57d 100644
--- a/anim-crop-tool/CMakeLists.txt
+++ b/anim-crop-tool/CMakeLists.txt
@@ -12,5 +12,5 @@ if(OpenCV_FOUND)
add_executable(${self} "${sources}")
target_link_libraries(${self} PRIVATE floormat-serialize floormat)
- install(TARGETS ${self} RUNTIME DESTINATION "bin")
+ fm_add_install_executable(${self})
endif()
diff --git a/bench/CMakeLists.txt b/bench/CMakeLists.txt
index 26afb999..bd4a7d3d 100644
--- a/bench/CMakeLists.txt
+++ b/bench/CMakeLists.txt
@@ -21,5 +21,4 @@ else()
endif()
target_link_libraries(${self} PUBLIC ${self}_o floormat-serialize floormat-draw floormat)
-install(TARGETS ${self} RUNTIME DESTINATION bin)
-fm_add_debug_info(${self})
+fm_add_install_executable(${self})
diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt
index 40c7016f..74da3536 100644
--- a/editor/CMakeLists.txt
+++ b/editor/CMakeLists.txt
@@ -31,5 +31,4 @@ if (FLOORMAT_ASAN)
endif()
target_link_libraries(${self} PRIVATE ${self}_o floormat-main floormat-serialize floormat-draw floormat)
-install(TARGETS ${self} RUNTIME DESTINATION bin)
-fm_add_debug_info(${self})
+fm_add_install_executable(${self})
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index ab11d536..7609655d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -18,8 +18,7 @@ if (FLOORMAT_ASAN)
set_target_properties(${self} PROPERTIES OUTPUT_NAME "floormat-test-asan")
endif()
-install(TARGETS ${self} RUNTIME DESTINATION bin)
-fm_add_debug_info(${self})
+fm_add_install_executable(${self})
set(save-dir "${CMAKE_BINARY_DIR}/test/save")
file(REMOVE_RECURSE "${save-dir}")