From 62e113ed3f2c563f68a4dc9c29659fd4bdb402b7 Mon Sep 17 00:00:00 2001 From: Mihai Tudor Panu Date: Mon, 28 Mar 2016 15:46:48 -0700 Subject: [PATCH] cmake: use LIB_INSTALL_DIR throughout instead of CMAKE_INSTALL_LIBDIR Signed-off-by: Mihai Tudor Panu Signed-off-by: Brendan Le Foll --- CMakeLists.txt | 8 ++++++-- src/CMakeLists.txt | 4 ++-- src/java/CMakeLists.txt | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c76a1b15..a2280a0fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,12 @@ FIND_PACKAGE (Threads REQUIRED) set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -fno-omit-frame-pointer ") set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall ") -set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation path for libraries") - +# Older cmake might not pick CMAKE_INSTALL_LIBDIR right +if (CMAKE_INSTALL_LIBDIR) + set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "Installation path for libraries") +else () + set (LIB_INSTALL_DIR "lib" CACHE PATH "Installation path for libraries") +endif () # Set CMAKE_LIB_INSTALL_DIR if not defined include(GNUInstallDirs) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 894f0a956..d41bc7500 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -137,7 +137,7 @@ macro (mraa_CREATE_INSTALL_PKGCONFIG generated_file install_location) configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location}) endmacro (mraa_CREATE_INSTALL_PKGCONFIG) -mraa_create_install_pkgconfig (mraa.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +mraa_create_install_pkgconfig (mraa.pc ${LIB_INSTALL_DIR}/pkgconfig) if (DOXYGEN_FOUND) @@ -208,4 +208,4 @@ set_target_properties( SOVERSION ${mraa_VERSION_MAJOR} VERSION ${mraa_VERSION_STRING} ) -install(TARGETS mraa DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS mraa DESTINATION ${LIB_INSTALL_DIR}) diff --git a/src/java/CMakeLists.txt b/src/java/CMakeLists.txt index 34de5cd4e..3b6317987 100644 --- a/src/java/CMakeLists.txt +++ b/src/java/CMakeLists.txt @@ -42,7 +42,7 @@ if (DOXYGEN_FOUND) endforeach () endif () -mraa_create_install_pkgconfig (mraajava.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +mraa_create_install_pkgconfig (mraajava.pc ${LIB_INSTALL_DIR}/pkgconfig) -install (TARGETS mraajava LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install (FILES ${CMAKE_CURRENT_BINARY_DIR}/mraa.jar DESTINATION ${CMAKE_INSTALL_LIBDIR}/../lib/java) +install (TARGETS mraajava LIBRARY DESTINATION ${LIB_INSTALL_DIR}) +install (FILES ${CMAKE_CURRENT_BINARY_DIR}/mraa.jar DESTINATION ${LIB_INSTALL_DIR}/../lib/java)