From fe4586c995a759e138c0a3de65ee8e1b5457b7f9 Mon Sep 17 00:00:00 2001 From: Dave B Date: Thu, 17 May 2018 12:55:17 -0400 Subject: [PATCH] Honor the -DCMAKE_INSTALL_PREFIX directive --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c4ce752b..266f8b3fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,8 +188,12 @@ endif(NOT ${OPENMP_FOUND}) #------------------------------------------------------------------------------- # default installation prefix #------------------------------------------------------------------------------- -set(INSTALL_PREFIX /usr/local CACHE PATH "Installation prefix") -set(CMAKE_INSTALL_PREFIX ${INSTALL_PREFIX} CACHE INTERNAL "Installation prefix" FORCE) +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation prefix") +endif() +if(NOT DEFINED INSTALL_PREFIX) + set(INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE INTERNAL "Installation prefix" FORCE) +endif() if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") set(DEFAULT_LIBRARIES pthread) else(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")