diff --git a/cmake/build/core.cmake b/cmake/build/core.cmake index 1d6f0e2c..c2053628 100644 --- a/cmake/build/core.cmake +++ b/cmake/build/core.cmake @@ -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() diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 8cad7fd3..790404f9 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -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()