Drop support for OPM_COMMON_ROOT.

Users should either rely in sibling search, use opm-common_DIR, or
set CMAKE_PREFIX_PATH correctly to find opm-common.
This commit is contained in:
Markus Blatt 2017-09-25 12:24:15 +02:00
parent a26cec6a6c
commit 54acb69d7a

View File

@ -19,17 +19,9 @@ project(opm-simulators CXX)
cmake_minimum_required (VERSION 2.8)
set( OPM_COMMON_ROOT "" CACHE PATH "Root directory containing OPM related cmake modules")
option(SIBLING_SEARCH "Search for other modules in sibling directories?" ON)
set( USE_OPENMP_DEFAULT OFF ) # Use of OpenMP is considered experimental
if(OPM_COMMON_ROOT AND opm-common_DIR)
message(WARNING "Both the variables OPM_COMMON_ROOT and opm-common_DIR are set. "
"Will use opm-common_DIR")
set(OPM_COMMON_ROOT "OPM_COMMON_ROOT-NOTFOUND")
endif()
if(NOT OPM_COMMON_ROOT)
if(SIBLING_SEARCH AND NOT opm-common_DIR)
# guess the sibling dir
get_filename_component(_leaf_dir_name ${PROJECT_BINARY_DIR} NAME)
@ -41,7 +33,6 @@ if(NOT OPM_COMMON_ROOT)
set(opm-common_DIR ${_modules_dir}/opm-common/${_leaf_dir_name})
else()
string(REPLACE ${PROJECT_NAME} opm-common _opm_common_leaf ${_leaf_dir_name})
message("_opm_common_leaf=${_opm_common_leaf}")
if(NOT _leaf_dir_name STREQUAL _opm_common_leaf
AND IS_DIRECTORY ${_parent_full_dir}/${_opm_common_leaf})
# We are using build directories named <prefix><module-name><postfix>
@ -57,44 +48,10 @@ if(NOT OPM_COMMON_ROOT)
" opm-common_DIR is not a directory")
endif()
endif()
find_package(opm-common REQUIRED)
endif()
if (opm-common_FOUND)
include(OpmInit)
else()
if(OPM_COMMON_ROOT)
message(WARNING "Setting OPM_COMMON_ROOT is deprecated. Please either "
"set opm-common_DIR instead or rely on sibling build")
endif()
unset(opm-common_FOUND)
if (NOT OPM_COMMON_ROOT AND SIBLING_SEARCH)
set(OPM_COMMON_ROOT ${PROJECT_SOURCE_DIR}/../opm-common)
endif()
if (OPM_COMMON_ROOT)
list( APPEND CMAKE_MODULE_PATH "${OPM_COMMON_ROOT}/cmake/Modules")
include (OpmInit OPTIONAL RESULT_VARIABLE OPM_INIT)
set( OPM_MACROS_ROOT ${OPM_COMMON_ROOT} )
endif()
if (NOT OPM_INIT)
message( "" )
message( " /---------------------------------------------------------------------------------\\")
message( " | Could not locate the opm build macros. The opm build macros |")
message( " | are in a separate repository - instructions to proceed: |")
message( " | |")
message( " | 1. Clone the repository: git clone git@github.com:OPM/opm-common.git |")
message( " | |")
message( " | 2. Run cmake in the current project with -DOPM_COMMON_ROOT=<path>/opm-common |")
message( " | |")
message( " \\---------------------------------------------------------------------------------/")
message( "" )
message( FATAL_ERROR "Could not find OPM Macros")
endif()
endif()
# not the same location as most of the other projects? this hook overrides