3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 22:03:43 +01:00

cmake: use ENV variable BOOST_SOURCE_DIR if present

if BOOST_SOURCE_DIR is defined in ENV variable,
and is not overruled by -DBOOST_SOURCE_DIR at cmake invocation
then we use it.

If BOOST_SOURCE_DIR is not defined in ENV variable,
and not defined by -DBOOST_SOURCE_DIR,
then we look for the system compiled boost.

-> allows to set up BOOST_SOURCE_DIR in your bashrc
on machine where boost compilation is needed, once for all
This commit is contained in:
Olivier Parcollet 2013-08-27 11:19:17 +02:00
parent 2b0e27835e
commit 3078401cb6

View File

@ -146,6 +146,14 @@ message(STATUS "MPI_CXX_INCLUDE_PATH : ${MPI_CXX_INCLUDE_PATH}")
message( STATUS "-------- Boost detection -------------") message( STATUS "-------- Boost detection -------------")
# Check user input for BOOST_SOURCE_DIR # Check user input for BOOST_SOURCE_DIR
# If user has defined BOOST_SOURCE_DIR in environment variable,
# and not overruled in on the command line -DBOOST_SOURCE_DIR, we take it
# If -DBOOST_SOURCE_DIR is not set, nor is the env variable BOOST_SOURCE_DIR,
# we take the installed one.
set (BOOST_SOURCE_DIR_ENV $ENV{BOOST_SOURCE_DIR})
if (NOT BOOST_SOURCE_DIR AND BOOST_SOURCE_DIR_ENV)
set (BOOST_SOURCE_DIR ${BOOST_SOURCE_DIR_ENV})
endif()
if(BOOST_SOURCE_DIR) if(BOOST_SOURCE_DIR)
if(NOT IS_ABSOLUTE ${BOOST_SOURCE_DIR}) if(NOT IS_ABSOLUTE ${BOOST_SOURCE_DIR})
Message(FATAL_ERROR "You must specify an absolute path for BOOST_SOURCE_DIR.") Message(FATAL_ERROR "You must specify an absolute path for BOOST_SOURCE_DIR.")