cmake: Installation paths

This commit is contained in:
Michael Carlberg 2016-11-30 18:22:10 +01:00
parent d5587bf6f6
commit a43309df9f
2 changed files with 22 additions and 9 deletions

View File

@ -56,3 +56,17 @@ if(ENABLE_CCACHE)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${BINPATH_ccache})
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${BINPATH_ccache})
endif()
# Install paths
if(NOT DEFINED CMAKE_INSTALL_BINDIR)
set(CMAKE_INSTALL_BINDIR bin)
endif()
if(NOT DEFINED CMAKE_INSTALL_SBINDIR)
set(CMAKE_INSTALL_SBINDIR sbin)
endif()
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR lib)
endif()
if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
set(CMAKE_INSTALL_INCLUDEDIR include)
endif()

View File

@ -63,14 +63,13 @@ function(make_executable target_name)
endforeach()
# link libraries that are build as part of this project
target_link_libraries(${target_name} ${BIN_TARGET_DEPENDS}
${BIN_RAW_DEPENDS})
target_link_libraries(${target_name} ${BIN_TARGET_DEPENDS} ${BIN_RAW_DEPENDS})
# install targets
install(TARGETS ${target_name}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endfunction()
# }}}
@ -149,13 +148,13 @@ function(make_library target_name)
set_target_properties(${library_target_name} PROPERTIES OUTPUT_NAME ${target_name})
# install headers
install(FILES ${LIBRARY_HEADERS} DESTINATION include/${LIB_HEADERS_ABS})
install(FILES ${LIBRARY_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIB_HEADERS_ABS})
# install targets
install(TARGETS ${LIBRARY_TARGETS}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endforeach()
endfunction()