From 1c3a20de50dcc02620a804fb67a10d3e38285023 Mon Sep 17 00:00:00 2001 From: Yu Xiaolei Date: Tue, 4 Nov 2014 12:44:48 +0800 Subject: [PATCH] Allow customization of component install dirs --- CMakeLists.txt | 10 ++++++++++ include/CMakeLists.txt | 2 +- src/lib_json/CMakeLists.txt | 6 +++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee2a8bf..806e726 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,16 @@ IF(NOT WIN32) ENDIF(NOT CMAKE_BUILD_TYPE) ENDIF(NOT WIN32) +SET(RUNTIME_INSTALL_DIR lib + CACHE PATH "Install dir for executables and dlls") +SET(ARCHIVE_INSTALL_DIR lib + CACHE PATH "Install dir for static libraries") +SET(LIBRARY_INSTALL_DIR lib + CACHE PATH "Install dir for shared libraries") +SET(INCLUDE_INSTALL_DIR include + CACHE PATH "Install dir for headers") +MARK_AS_ADVANCED( RUNTIME_INSTALL_DIR ARCHIVE_INSTALL_DIR INCLUDE_INSTALL_DIR ) + # This ensures shared DLL are in the same dir as executable on Windows. # Put all executables / libraries are in a project global directory. SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 7d832a0..7dde10d 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,2 +1,2 @@ FILE(GLOB INCLUDE_FILES "json/*.h") -INSTALL(FILES ${INCLUDE_FILES} DESTINATION include/json) +INSTALL(FILES ${INCLUDE_FILES} DESTINATION ${INCLUDE_INSTALL_DIR}/json) diff --git a/src/lib_json/CMakeLists.txt b/src/lib_json/CMakeLists.txt index 16036d1..738ba64 100644 --- a/src/lib_json/CMakeLists.txt +++ b/src/lib_json/CMakeLists.txt @@ -41,7 +41,7 @@ SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSI # Install instructions for this target INSTALL( TARGETS jsoncpp_lib - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR} + LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} + ARCHIVE DESTINATION ${ARCHIVE_INSTALL_DIR} )