summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-20 17:06:06 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-20 17:06:06 +0200
commit6bd66bdba425cb7a87b8961cc648e71b56ffec2e (patch)
tree349f67c84a80baefcde460a0fca9626a4a63ada8 /cmake
parent2110fba1295c89a08154791b3aa2191b25c02894 (diff)
cmake: set install prefix permissions consistently
Diffstat (limited to 'cmake')
-rw-r--r--cmake/opentrack-boilerplate.cmake6
-rw-r--r--cmake/opentrack-install.cmake52
2 files changed, 36 insertions, 22 deletions
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index 4546de28..ae5aedc8 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -1,3 +1,5 @@
+set(opentrack-perms PERMISSIONS WORLD_READ WORLD_EXECUTE OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
+
set(new-hier-path "#pragma once
#ifndef OPENTRACK_NO_QT_PATH
@@ -95,9 +97,9 @@ 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}")
+ 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}")
+ 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)
diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake
index 580ec135..601c89c3 100644
--- a/cmake/opentrack-install.cmake
+++ b/cmake/opentrack-install.cmake
@@ -1,35 +1,47 @@
-set(opentrack-perms PERMISSIONS WORLD_READ WORLD_EXECUTE OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
+set(opentrack-perms_ WORLD_READ WORLD_EXECUTE OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE)
+set(opentrack-perms PERMISSIONS ${opentrack-perms_})
+
+macro(opentrack_inst2 path)
+ install(${ARGN} DESTINATION "${path}" ${opentrack-perms})
+endmacro()
+
+macro(opentrack_inst_dir path)
+ install(
+ DIRECTORY ${ARGN} DESTINATION "${path}"
+ FILE_PERMISSIONS ${opentrack-perms_}
+ DIRECTORY_PERMISSIONS ${opentrack-perms_}
+ )
+endmacro()
+
+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")
+opentrack_inst_dir("${opentrack-doc-src-pfx}" "${CMAKE_SOURCE_DIR}/bin")
if(WIN32)
- install(FILES "${CMAKE_SOURCE_DIR}/bin/qt.conf" DESTINATION . ${opentrack-perms})
- install(FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config" DESTINATION . ${opentrack-perms})
- install(FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config" DESTINATION ${opentrack-hier-pfx} ${opentrack-perms})
+ opentrack_inst2(. FILES "${CMAKE_SOURCE_DIR}/bin/qt.conf")
+ opentrack_inst2(. FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config")
+ opentrack_inst2(${opentrack-hier-pfx} FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config")
endif()
-install(FILES ${CMAKE_SOURCE_DIR}/README.md DESTINATION ${opentrack-doc-pfx})
-
-install(DIRECTORY ${CMAKE_SOURCE_DIR}/3rdparty-notices DESTINATION ${opentrack-doc-pfx})
-install(DIRECTORY "${CMAKE_SOURCE_DIR}/settings" "${CMAKE_SOURCE_DIR}/contrib" DESTINATION ${opentrack-doc-pfx})
+opentrack_inst2("${opentrack-doc-pfx}" FILES ${CMAKE_SOURCE_DIR}/README.md)
-install(FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient.dll" DESTINATION ${opentrack-hier-pfx} ${opentrack-perms})
-install(FILES
+opentrack_inst2("${opentrack-hier-pfx}" FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient.dll")
+opentrack_inst2("${opentrack-hier-pfx}" FILES
"${CMAKE_SOURCE_DIR}/bin/NPClient.dll"
"${CMAKE_SOURCE_DIR}/bin/NPClient64.dll"
- "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe"
- DESTINATION ${opentrack-hier-pfx} ${opentrack-perms})
+ "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe")
-install(FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt" DESTINATION "${opentrack-doc-src-pfx}")
-install(DIRECTORY "${CMAKE_SOURCE_DIR}/cmake" DESTINATION "${opentrack-doc-src-pfx}")
-install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin" DESTINATION "${opentrack-doc-src-pfx}")
-install(FILES "${CMAKE_SOURCE_DIR}/README.md" DESTINATION "${opentrack-doc-src-pfx}")
-install(FILES "${CMAKE_SOURCE_DIR}/CONTRIBUTING.md" DESTINATION "${opentrack-doc-src-pfx}")
-install(FILES "${CMAKE_SOURCE_DIR}/WARRANTY.txt" DESTINATION "${opentrack-doc-src-pfx}")
+opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt")
+opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/README.md")
+opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CONTRIBUTING.md")
+opentrack_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/WARRANTY.txt")
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_inst2("${opentrack-doc-src-pfx}/${subdir}" FILES "${i}")
endforeach()
- install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" DESTINATION "${opentrack-doc-src-pfx}/${subdir}")
+ opentrack_inst2("${opentrack-doc-src-pfx}/${subdir}" FILES "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt")
endfunction()