summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-02-24 17:05:49 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-02-24 17:05:49 +0100
commit857ade6d3ea723f5caa0c63632f855eb6e9eacee (patch)
treed26a2be2d9e1db7f61099dd3a9da2271dcfb197f
parent8e7c72ce68c8b1dbb79cf32c96b25f1b8b57ab6e (diff)
cmake: install program sources more robustly
Before it skipped some subdirectory parts.
-rwxr-xr-xCMakeLists.txt1
-rw-r--r--cmake/opentrack-boilerplate.cmake33
-rw-r--r--cmake/opentrack-install.cmake17
3 files changed, 14 insertions, 37 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 60a56679..51d037c7 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,3 +77,4 @@ foreach(i ${opentrack-subprojects})
endforeach()
merge_translations()
+install_sources()
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index eaab2f99..03c090f3 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -79,30 +79,8 @@ function(opentrack_compat target)
opentrack_fixup_subsystem(${target})
endfunction()
-function(opentrack_sources n ret)
- get_target_property(srcs ${n} SOURCES)
- if(srcs)
- foreach(f ${srcs})
- get_source_file_property(autogen "${f}" GENERATED)
- if(NOT autogen)
- list(APPEND ${ret} "${f}")
- endif()
- endforeach()
- endif()
- set(${ret} "${${ret}}" PARENT_SCOPE)
-endfunction()
-
include(CMakeParseArguments)
-function(opentrack_install_sources n)
- opentrack_sources(${n} sources)
- file(RELATIVE_PATH subdir "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
- foreach (i ${sources})
- install(FILES "${i}" DESTINATION "${opentrack-doc-src-pfx}/${subdir}" ${opentrack-perms})
- endforeach()
- install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" DESTINATION "${opentrack-doc-src-pfx}/${subdir}" ${opentrack-perms})
-endfunction()
-
function(opentrack_is_target_c_only ret srcs)
set(val TRUE)
foreach(i ${srcs})
@@ -179,9 +157,6 @@ function(opentrack_boilerplate n)
target_link_libraries(${n} opentrack-api opentrack-options opentrack-compat)
endif()
- if(NOT arg_NO-INSTALL)
- opentrack_install_sources(${n})
- endif()
opentrack_compat(${n})
if(CMAKE_COMPILER_IS_GNUCXX)
@@ -227,9 +202,7 @@ function(opentrack_boilerplate n)
set_property(GLOBAL PROPERTY "opentrack-ts-${i}" "${tt}")
endforeach()
- get_property(modules GLOBAL PROPERTY opentrack-all-modules)
- list(APPEND modules "${n}")
- set_property(GLOBAL PROPERTY opentrack-all-modules "${modules}")
+ set_property(GLOBAL APPEND PROPERTY opentrack-all-modules "${n}")
foreach(i ${langs})
add_custom_command(OUTPUT "${i}"
@@ -241,5 +214,9 @@ function(opentrack_boilerplate n)
endforeach()
add_custom_target(i18n-module-${n} DEPENDS ${langs})
+
+ if(NOT arg_NO-INSTALL)
+ set_property(GLOBAL APPEND PROPERTY opentrack-all-source-dirs "${CMAKE_CURRENT_SOURCE_DIR}")
+ endif()
endfunction()
diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake
index 4762c5f7..df9e38fc 100644
--- a/cmake/opentrack-install.cmake
+++ b/cmake/opentrack-install.cmake
@@ -13,6 +13,14 @@ macro(opentrack_inst_dir path)
)
endmacro()
+function(install_sources)
+ get_property(source-dirs GLOBAL PROPERTY opentrack-all-source-dirs)
+ foreach(k ${source-dirs})
+ file(RELATIVE_PATH dest "${CMAKE_SOURCE_DIR}" "${k}")
+ opentrack_inst_dir("${opentrack-doc-src-pfx}" "${dest}")
+ endforeach()
+endfunction()
+
opentrack_inst_dir("${opentrack-doc-pfx}" ${CMAKE_SOURCE_DIR}/3rdparty-notices)
opentrack_inst_dir("${opentrack-doc-pfx}" "${CMAKE_SOURCE_DIR}/settings" "${CMAKE_SOURCE_DIR}/contrib")
opentrack_inst_dir("${opentrack-doc-src-pfx}" "${CMAKE_SOURCE_DIR}/cmake")
@@ -39,15 +47,6 @@ opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/WARRANTY.t
opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/OPENTRACK-LICENSING.txt")
opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/AUTHORS.md")
-function(opentrack_install_sources n)
- opentrack_sources(${n} sources)
- file(RELATIVE_PATH subdir "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
- foreach (i ${sources})
- opentrack_inst2("${opentrack-doc-src-pfx}/${subdir}" FILES "${i}")
- endforeach()
- opentrack_inst2("${opentrack-doc-src-pfx}/${subdir}" FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt")
-endfunction()
-
function(merge_translations)
set(all-deps "")