Merge pull request #490 from blattms/make-arbitrary-sibling-possible

[cmake] Makes arbitrary build subdirectories possible.
This commit is contained in:
Atgeirr Flø Rasmussen 2014-02-06 23:39:57 +01:00
commit ae4c6eab18
3 changed files with 10 additions and 6 deletions

View File

@ -31,13 +31,14 @@ if (CMAKE_SIZEOF_VOID_P)
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}") math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
endif (CMAKE_SIZEOF_VOID_P) endif (CMAKE_SIZEOF_VOID_P)
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/?(.*)" "\\1" BUILD_DIR_SUFFIX "${PROJECT_BINARY_DIR}")
find_library (CJSON_LIBRARY find_library (CJSON_LIBRARY
NAMES "cjson" NAMES "cjson"
HINTS "${CJSON_ROOT}" HINTS "${CJSON_ROOT}"
PATHS "${PROJECT_BINARY_DIR}/../opm-parser" PATHS "${PROJECT_BINARY_DIR}/../opm-parser"
"${PROJECT_BINARY_DIR}/../opm-parser-build" "${PROJECT_BINARY_DIR}/../opm-parser${BUILD_DIR_SUFFIX}"
"${PROJECT_BINARY_DIR}/../../opm-parser/build" "${PROJECT_BINARY_DIR}/../../opm-parser/${BUILD_DIR_SUFFIX}"
"${PROJECT_BINARY_DIR}/../../opm-parser/cmake-build"
PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" PATH_SUFFIXES "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}"
"opm/json" "opm/json"
DOC "Path to cjson library archive/shared object files" DOC "Path to cjson library archive/shared object files"

View File

@ -31,6 +31,9 @@ if ((NOT OPM_PARSER_ROOT) AND OPM_ROOT)
set (OPM_PARSER_ROOT "${OPM_ROOT}/opm-parser") set (OPM_PARSER_ROOT "${OPM_ROOT}/opm-parser")
endif () endif ()
# Detect the build dir suffix or subdirectory
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/?(.*)" "\\1" BUILD_DIR_SUFFIX "${PROJECT_BINARY_DIR}")
# if a root is specified, then don't search in system directories # if a root is specified, then don't search in system directories
# or in relative directories to this one # or in relative directories to this one
if (OPM_PARSER_ROOT) if (OPM_PARSER_ROOT)
@ -43,9 +46,8 @@ else ()
"${PROJECT_SOURCE_DIR}/../opm-parser") "${PROJECT_SOURCE_DIR}/../opm-parser")
set (_opm_parser_build set (_opm_parser_build
"${PROJECT_BINARY_DIR}/../opm-parser" "${PROJECT_BINARY_DIR}/../opm-parser"
"${PROJECT_BINARY_DIR}/../opm-parser-build" "${PROJECT_BINARY_DIR}/../opm-parser${BUILD_DIR_SUFFIX}"
"${PROJECT_BINARY_DIR}/../../opm-parser/build" "${PROJECT_BINARY_DIR}/../../opm-parser/${BUILD_DIR_SUFFIX}")
"${PROJECT_BINARY_DIR}/../../opm-parser/cmake-build")
endif () endif ()
# use this header as signature # use this header as signature

View File

@ -59,6 +59,7 @@ set (_opm_proj_exemptions
dune-istl dune-istl
dune-grid dune-grid
dune-geometry dune-geometry
opm-parser
) )
# although a DUNE module, it is delivered in the OPM suite # although a DUNE module, it is delivered in the OPM suite