mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Changed logic for finding cmake modules
This commit is contained in:
@@ -16,14 +16,43 @@
|
|||||||
|
|
||||||
cmake_minimum_required (VERSION 2.8)
|
cmake_minimum_required (VERSION 2.8)
|
||||||
|
|
||||||
# additional search modules
|
set( OPM_CMAKE_ROOT "" CACHE PATH "Root directory containing OPM related cmake modules")
|
||||||
find_path (OPM_MACROS_ROOT cmake/Modules/OpmInit.cmake
|
|
||||||
PATHS ${opm-macros_ROOT}
|
include (OpmInit OPTIONAL RESULT_VARIABLE OPM_INIT)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
DOC "Path to build system macros and scripts"
|
if (OPM_INIT)
|
||||||
NO_DEFAULT_PATH
|
|
||||||
)
|
# We actually found the OpmInit module without using the OPM_CMAKE_ROOT variable.
|
||||||
list (APPEND CMAKE_MODULE_PATH "${OPM_MACROS_ROOT}/cmake/Modules")
|
# The build needs the variable $OPM_MACROS_ROOT to be set, so here we infer it
|
||||||
|
# by backtracing from the location of the OpmInit module.
|
||||||
|
get_filename_component( TMP1 ${OPM_INIT} PATH )
|
||||||
|
get_filename_component( TMP2 ${TMP1} PATH )
|
||||||
|
get_filename_component( OPM_MACROS_ROOT ${TMP2} PATH )
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
if (OPM_CMAKE_ROOT)
|
||||||
|
list( APPEND CMAKE_MODULE_PATH "${OPM_CMAKE_ROOT}/cmake/Modules")
|
||||||
|
include (OpmInit OPTIONAL RESULT_VARIABLE OPM_INIT)
|
||||||
|
set( OPM_MACROS_ROOT ${OPM_CMAKE_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-cmake.git |")
|
||||||
|
message( " | |")
|
||||||
|
message( " | 2. Run cmake in the current project with -DOPM_CMAKE_ROOT=<path>/opm-cmake |")
|
||||||
|
message( " | |")
|
||||||
|
message( " \\-------------------------------------------------------------------------------/")
|
||||||
|
message( "" )
|
||||||
|
message( FATAL_ERROR "Could not find OPM Macros")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
option( INCLUDE_NON_PUBLIC_TESTS "Include the tests which need non-public data" OFF)
|
option( INCLUDE_NON_PUBLIC_TESTS "Include the tests which need non-public data" OFF)
|
||||||
|
|
||||||
@@ -39,7 +68,7 @@ include (OpmInit)
|
|||||||
# list of prerequisites for this particular project; this is in a
|
# list of prerequisites for this particular project; this is in a
|
||||||
# separate file (in cmake/Modules sub-directory) because it is shared
|
# separate file (in cmake/Modules sub-directory) because it is shared
|
||||||
# with the find module
|
# with the find module
|
||||||
include (${project}-prereqs)
|
include ("${project}-prereqs.cmake")
|
||||||
|
|
||||||
# read the list of components from this file (in the project directory);
|
# read the list of components from this file (in the project directory);
|
||||||
# it should set various lists with the names of the files to include
|
# it should set various lists with the names of the files to include
|
||||||
|
|||||||
Reference in New Issue
Block a user