summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-29 02:02:59 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-10-15 18:22:20 +0200
commitba8482dff2c76f186b09d312470d2e83b4223de5 (patch)
tree2869b2bb5f265d414861adcd2b076b912c9c9363
parentf87f0254aa6cc37e0315bb523330fac3b49b1508 (diff)
Overload CMAKE_INSTALL_PREFIX if custom defined
Change-Id: I327d6af1862b4732f91d78abe26c7ffd6d2fbe51 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--cmake/common.cmake8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmake/common.cmake b/cmake/common.cmake
index d23614f..fa7b369 100644
--- a/cmake/common.cmake
+++ b/cmake/common.cmake
@@ -310,7 +310,13 @@ set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -ggdb -Wp,-U_FORTIFY_SOURCE")
set(CMAKE_CXX_FLAGS_RELEASE "-g -O2")
set(CMAKE_CXX_FLAGS_CCOV "-g -O2 --coverage")
-set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/Install" CACHE PATH "The path where to install")
+# Env variable overload default
+if(DEFINED ENV{INSTALL_PREFIX})
+ set (INSTALL_PREFIX $ENV{INSTALL_PREFIX})
+else()
+ set(INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/Install" CACHE PATH "The path where to install")
+endif()
+set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX} CACHE STRING "Installation Prefix" FORCE)
# (BUG!!!) as PKG_CONFIG_PATH does not work [should be en env variable]
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON CACHE BOOLEAN "Flag for using prefix path")