summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-11-22 16:11:44 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-11-22 16:16:33 +0100
commit2611db2643d3d02816c24260b8d918655d07ec88 (patch)
treef4701172c91d3b4d26b0aaeddd3a5281c9527bb1
parent24ac27e53baf95e58aadf1f2e8c75635aa7316ab (diff)
cmake: fix assets snafu
-rw-r--r--CMakeLists.txt20
1 files changed, 19 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b7ab130..1411d2e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -257,7 +257,25 @@ if(TARGET benchmark::benchmark OR TARGET benchmark)
add_subdirectory(bench)
endif()
-install(DIRECTORY images anim scenery vobj wall-tilesets DESTINATION "share/floormat")
+function(fm_escape_string var str)
+ string(REGEX REPLACE "([^_A-Za-z0-9./:-])" "\\\\\\1" str "${str}")
+ set(${var} "${str}" PARENT_SCOPE)
+endfunction()
+
+function(fm_install_kill_directory dir)
+ fm_escape_string(quoted-dir "${CMAKE_INSTALL_PREFIX}/share/floormat/${dir}")
+ #install(CODE "message(FATAL_ERROR \"foo ${quoted-dir}\")")
+ install(CODE "file(REMOVE_RECURSE \"${quoted-dir}\")")
+endfunction()
+
+function(fm_install_assets)
+ set(CMAKE_INSTALL_MESSAGE NEVER)
+ foreach(subdir images anim scenery vobj wall-tilesets)
+ fm_install_kill_directory("${subdir}")
+ install(DIRECTORY "${subdir}" DESTINATION "share/floormat")
+ endforeach()
+endfunction()
+fm_install_assets()
fm_run_hook(fm-userconfig-post)