From: TimePath Date: Mon, 21 Mar 2016 01:15:29 +0000 (+1100) Subject: CMake: copy, prelude X-Git-Tag: xonotic-v0.8.2~959^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=44595603cb4118272d1756d6cef0b660abf3a7e1;p=xonotic%2Fxonotic-data.pk3dir.git CMake: copy, prelude --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 767c90db6..c235c9775 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,29 @@ add_executable(menu qcsrc/menu/progs.inc) target_compile_definitions(menu PRIVATE -DMENUQC) add_dependencies(menu gmqcc) +function(set_prelude target prelude) + get_target_property(MY_PROJECT_SOURCES target SOURCES) + foreach (source IN LISTS MY_PROJECT_SOURCES) + set_property( + SOURCE ${source} + APPEND PROPERTY COMPILE_FLAGS + "-include ${PROJECT_SOURCE_DIR}/${prelude}" + ) + endforeach () +endfunction() +# set_prelude(csprogs qcsrc/lib/_all.inc) + +function(copy prog) + add_custom_command(TARGET ${prog} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "$/${prog}.dat" "${prog}.dat" + COMMAND ${CMAKE_COMMAND} -E copy "$/${prog}.lno" "${prog}.lno" + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + VERBATIM) +endfunction() +copy(csprogs) +copy(progs) +copy(menu) + function(pack prog) add_custom_target(${prog}.pk3 DEPENDS ${prog}-${GIT_DESC}.pk3 @@ -49,7 +72,7 @@ function(pack prog) "${prog}-${GIT_DESC}.txt" "${prog}-${GIT_DESC}.dat" "${prog}-${GIT_DESC}.lno" - VERBATIM + VERBATIM ) endfunction() pack(csprogs)