summaryrefslogtreecommitdiffhomepage
path: root/cmake/opentrack-hier.cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-07-19 05:44:02 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-07-19 07:17:25 +0200
commitccb7f5167a07d5a886722f7d64d0f2b550a7a5a0 (patch)
treec0994383b3c899c22a47b5d270c81111809b74bb /cmake/opentrack-hier.cmake
parent8d2c70f000ca00c8ebc571467a383a03442282df (diff)
cmake: install source code as well
Diffstat (limited to 'cmake/opentrack-hier.cmake')
-rw-r--r--cmake/opentrack-hier.cmake76
1 files changed, 49 insertions, 27 deletions
diff --git a/cmake/opentrack-hier.cmake b/cmake/opentrack-hier.cmake
index ee2d0bbf..a9c1ee1a 100644
--- a/cmake/opentrack-hier.cmake
+++ b/cmake/opentrack-hier.cmake
@@ -1,29 +1,51 @@
-if(APPLE)
- set(opentrack-hier-pfx ".")
- set(opentrack-hier-path "/")
- set(opentrack-hier-doc "/")
- set(opentrack-hier-str RUNTIME DESTINATION . LIBRARY DESTINATION .)
- set(opentrack-doc-pfx ".")
-elseif(WIN32)
- set(opentrack-hier-pfx "./modules")
- set(opentrack-hier-path "/modules/")
- set(opentrack-hier-doc "/doc/")
- set(opentrack-doc-pfx "./doc")
- set(opentrack-hier-str RUNTIME DESTINATION ./modules/ LIBRARY DESTINATION ./modules/)
-else()
- set(opentrack-hier-pfx "libexec/opentrack")
- set(opentrack-hier-path "/../libexec/opentrack/")
- set(opentrack-hier-doc "/share/doc/opentrack/")
- set(opentrack-doc-pfx "./share/doc/opentrack")
- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${opentrack-hier-pfx}")
- set(opentrack-hier-str ARCHIVE DESTINATION lib/opentrack LIBRARY DESTINATION ${opentrack-hier-pfx} RUNTIME DESTINATION bin)
-endif()
+if(NOT opentrack-hier-included)
+ set(opentrack-hier-included TRUE)
-set(opentrack-contrib-pfx "${opentrack-doc-pfx}/contrib")
+ if(APPLE)
+ set(opentrack-hier-pfx ".")
+ set(opentrack-hier-path "/")
+ set(opentrack-hier-doc "/")
+ set(opentrack-hier-str RUNTIME DESTINATION . LIBRARY DESTINATION .)
+ set(opentrack-doc-pfx "./doc")
+ set(opentrack-doc-src-pfx "./source-code")
+ elseif(WIN32)
+ set(opentrack-hier-pfx "./modules")
+ set(opentrack-hier-path "/modules/")
+ set(opentrack-hier-doc "/doc/")
+ set(opentrack-doc-pfx "./doc")
+ set(opentrack-doc-src-pfx "./source-code")
+ set(opentrack-hier-str RUNTIME DESTINATION ./modules/ LIBRARY DESTINATION ./modules/)
+ else()
+ set(opentrack-hier-pfx "libexec/opentrack")
+ set(opentrack-hier-path "/../libexec/opentrack/")
+ set(opentrack-hier-doc "/share/doc/opentrack/")
+ set(opentrack-doc-pfx "./share/doc/opentrack")
+ set(opentrack-doc-src-pfx "./share/doc/opentrack/source-code")
+ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${opentrack-hier-pfx}")
+ set(opentrack-hier-str ARCHIVE DESTINATION lib/opentrack LIBRARY DESTINATION ${opentrack-hier-pfx} RUNTIME DESTINATION bin)
+ endif()
-set(opentrack-binary-suffix "")
-if(APPLE)
- set(opentrack-binary-suffix ".bin")
-elseif(WIN32)
- set(opentrack-binary-suffix ".exe")
-endif()
+ function(opentrack_escape_string var str)
+ string(REGEX REPLACE "([\$\\\"#])" "\\\\\\1" tmp__ "${str}")
+ set(${var} "${tmp__}" PARENT_SCOPE)
+ endfunction()
+
+ function(opentrack_setup_refresh_install_dir)
+ if((NOT CMAKE_INSTALL_PREFIX STREQUAL "") AND (NOT opentrack-doc-src-pfx STREQUAL ""))
+ opentrack_escape_string(dir "${CMAKE_INSTALL_PREFIX}/${opentrack-doc-src-pfx}/")
+ install(CODE "file(REMOVE_RECURSE \"${dir}\")")
+ endif()
+ endfunction()
+
+ opentrack_setup_refresh_install_dir()
+
+ set(opentrack-contrib-pfx "${opentrack-doc-pfx}/contrib")
+
+ set(opentrack-binary-suffix "")
+ if(APPLE)
+ set(opentrack-binary-suffix ".bin")
+ elseif(WIN32)
+ set(opentrack-binary-suffix ".exe")
+ endif()
+
+endif() # include guard