From 5ccda05d8c05e21aae4297f0b06eb05011c6a646 Mon Sep 17 00:00:00 2001 From: Axel Isouard Date: Sun, 5 Feb 2017 06:26:26 -0800 Subject: [PATCH] Set better install paths for lib, include and cmake components --- CMakeLists.txt | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b0354f..77bc026 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,21 +44,20 @@ option(BUILD_TESTS "Build test binaries" OFF) set(NINJA_ARGS "" CACHE STRING "Ninja arguments to pass before compiling WebRTC") # -# Directories -# +# Offer the user the choice of overriding the installation directories +set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries") +set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables") +set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files") +set(INSTALL_CMAKE_DIR lib/cmake/LibWebRTC CACHE PATH "Installation directory for CMake files") -if (NOT LIBWEBRTC_INSTALL_BIN_DIR) - set(LIBWEBRTC_INSTALL_BIN_DIR "bin") -endif () -if (NOT LIBWEBRTC_INSTALL_LIB_DIR) - set(LIBWEBRTC_INSTALL_LIB_DIR "lib") -endif () -if (NOT LIBWEBRTC_INSTALL_DATA_DIR) - set(LIBWEBRTC_INSTALL_DATA_DIR "share") -endif () -if (NOT LIBWEBRTC_INSTALL_INCLUDE_DIR) - set(LIBWEBRTC_INSTALL_INCLUDE_DIR "include") -endif () +# +# Make relative paths absolute (needed later on) +foreach(p LIB BIN INCLUDE CMAKE) + set(var INSTALL_${p}_DIR) + if(NOT IS_ABSOLUTE "${${var}}") + set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}") + endif() +endforeach() # # Target OS