mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Allow arbitrary clone directories and <prefix><module-name><postfix> build directories
This commit is contained in:
parent
0b83f68cdc
commit
a26cec6a6c
@ -35,15 +35,19 @@ if(NOT OPM_COMMON_ROOT)
|
||||
get_filename_component(_leaf_dir_name ${PROJECT_BINARY_DIR} NAME)
|
||||
get_filename_component(_parent_full_dir ${PROJECT_BINARY_DIR} DIRECTORY)
|
||||
get_filename_component(_parent_dir_name ${_parent_full_dir} NAME)
|
||||
if(_parent_dir_name STREQUAL CMAKE_PROJECT_NAME)
|
||||
#looks like <module-name>/<build-dir> is used
|
||||
#Try if <module-name>/<build-dir> is used
|
||||
get_filename_component(_modules_dir ${_parent_full_dir} DIRECTORY)
|
||||
if(IS_DIRECTORY ${_modules_dir}/opm-common/${_leaf_dir_name})
|
||||
set(opm-common_DIR ${_modules_dir}/opm-common/${_leaf_dir_name})
|
||||
endif()
|
||||
elseif(_leaf_dir_name STREQUAL CMAKE_PROJECT_NAME)
|
||||
# we assume <build-dir>/<module-name>
|
||||
if(IS_DIRECTORY ${_parent_full_dir}/opm-common)
|
||||
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>
|
||||
set(opm-common_DIR ${_parent_full_dir}/${_opm_common_leaf})
|
||||
elseif(IS_DIRECTORY ${_parent_full_dir}/opm-common)
|
||||
# All modules are in a common build dir
|
||||
set(opm-common_DIR "${_parent_full_dir}/opm-common}")
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user