Unverified Commit a1b3eed6 authored by Tomáš Pecka's avatar Tomáš Pecka Committed by Tomáš Pecka

cmake: use GNUInstallDirs (#187)

parent 6053bf35
# install paths
# -------------
include(GNUInstallDirs)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX /usr)
endif()
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if(NOT LIBRARY_INSTALL_DIRECTORY)
set(LIBRARY_INSTALL_DIRECTORY "lib")
endif()
message ( "[Install] Install directory prefix is: ${CMAKE_INSTALL_PREFIX}" )
message ( "[Install] Library install directory is: ${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIRECTORY}" )
message ( "[Install] Full install paths: ${CMAKE_INSTALL_FULL_BINDIR}, ${CMAKE_INSTALL_FULL_LIBDIR}, ${CMAKE_INSTALL_FULL_INCLUDEDIR}" )
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
......@@ -23,4 +23,4 @@ target_include_directories(${{PROJECT_NAME}}
target_link_libraries(${{PROJECT_NAME}} {target_libs})
# Install
install(TARGETS ${{PROJECT_NAME}} RUNTIME DESTINATION bin)
install(TARGETS ${{PROJECT_NAME}} RUNTIME DESTINATION ${{CMAKE_INSTALL_BINDIR}})
......@@ -30,12 +30,12 @@ set_target_properties(${{PROJECT_NAME}} PROPERTIES
)
# Install
install(TARGETS ${{PROJECT_NAME}} LIBRARY DESTINATION ${{LIBRARY_INSTALL_DIRECTORY}})
install(TARGETS ${{PROJECT_NAME}} LIBRARY DESTINATION ${{CMAKE_INSTALL_LIBDIR}})
FOREACH(HEADER {include_files})
get_filename_component(DIR ${{HEADER}} DIRECTORY)
STRING(REGEX REPLACE "^src" "" DIR ${{DIR}})
INSTALL(FILES ${{HEADER}} DESTINATION include/algorithms-library/${{DIR}})
INSTALL(FILES ${{HEADER}} DESTINATION ${{CMAKE_INSTALL_INCLUDEDIR}}/algorithms-library/${{DIR}})
ENDFOREACH(HEADER)
########################################################################################################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment