aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/cmake.d/03-macros.cmake7
-rw-r--r--cmake/common.cmake1
-rw-r--r--samples.d/config.cmake.sample6
3 files changed, 11 insertions, 3 deletions
diff --git a/cmake/cmake.d/03-macros.cmake b/cmake/cmake.d/03-macros.cmake
index 085c249..0d24a40 100644
--- a/cmake/cmake.d/03-macros.cmake
+++ b/cmake/cmake.d/03-macros.cmake
@@ -108,6 +108,13 @@ ENDMACRO(LIST_FILTER)
# Generic useful macro
# -----------------------
+macro(set_install_prefix)
+ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND INSTALL_PREFIX)
+ message(STATUS "-- Overwrite the CMAKE default install prefix with ${INSTALL_PREFIX}")
+ set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX} CACHE PATH "Install prefix" FORCE)
+ endif()
+endmacro()
+
macro(PROJECT_TARGET_ADD TARGET_NAME)
set_property(GLOBAL APPEND PROPERTY PROJECT_TARGETS ${TARGET_NAME})
set(TARGET_NAME ${TARGET_NAME})
diff --git a/cmake/common.cmake b/cmake/common.cmake
index e764d34..8e57b26 100644
--- a/cmake/common.cmake
+++ b/cmake/common.cmake
@@ -85,6 +85,7 @@ foreach(file ${system_cmakefiles} ${home_cmakefiles} ${project_cmakefiles})
include(${file})
endforeach()
+set_install_prefix()
prevent_in_source_build()
if(DEFINED PROJECT_SRC_DIR_PATTERN)
diff --git a/samples.d/config.cmake.sample b/samples.d/config.cmake.sample
index 55de5c2..d7268cd 100644
--- a/samples.d/config.cmake.sample
+++ b/samples.d/config.cmake.sample
@@ -76,7 +76,7 @@ set (PKG_REQUIRED_LIST
# Prefix path where will be installed the files
# Default: /usr/local (need root permission to write in)
# ------------------------------------------------------
-#set(CMAKE_INSTALL_PREFIX $ENV{HOME}/opt)
+#set(INSTALL_PREFIX /opt/AGL CACHE PATH "INSTALL PREFIX PATH")
# Customize link option
# -----------------------------
@@ -127,8 +127,8 @@ set (PKG_REQUIRED_LIST
# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable]
# ---------------------------------------------------------------------
-set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
-set(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)
+set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig CACHE PATH 'Prefix Path list used by pkgconfig module')
+set(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib CACHE PATH 'Path list where to search for libraries')
# Optional location for config.xml.in
# -----------------------------------