Findopm-parser.cmake: make sure that the ERT libraries are available

and some other minor cleanups to the module. For me it still works,
but this being the build system, I can't guarantee more...
This commit is contained in:
Andreas Lauser 2014-06-11 22:05:02 +02:00 committed by Bård Skaflestad
parent 99b4cf5067
commit d530dcfe17
2 changed files with 55 additions and 75 deletions

View File

@ -78,11 +78,6 @@ if ((NOT OPM_PARSER_INCLUDE_DIR) AND
endif ()
endif ()
# find out the size of a pointer. this is required to only search for
# libraries in the directories relevant for the architecture
if (CMAKE_SIZEOF_VOID_P)
math (EXPR _BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
endif (CMAKE_SIZEOF_VOID_P)
# these libraries constitute the parser core
find_library (OPM_PARSER_LIBRARY
@ -94,6 +89,7 @@ find_library (OPM_PARSER_LIBRARY
DOC "Path to OPM parser library archive/shared object files"
${_no_default_path} )
# find the OPM-parser wrapper library around cJSON
find_library (OPM_JSON_LIBRARY
NAMES "opm-json"
HINTS "${OPM_PARSER_ROOT}"
@ -103,21 +99,24 @@ find_library (OPM_JSON_LIBRARY
DOC "Path to OPM JSON library archive/shared object files"
${_no_default_path} )
# get the prerequisite CJSON library
if (NOT CJSON_FOUND)
find_package (cjson ${OPM_PARSER_QUIET})
# get the prerequisite ERT libraries
if (NOT ERT_FOUND)
find_package(ERT ${opm-parser_FIND_REQUIRED} ${OPM_PARSER_QUIET})
endif ()
# get the prerequisite CJSON library
if (NOT CJSON_FOUND)
set(opm-parser_FOUND "0")
else()
find_package(cjson ${opm-parser_FIND_REQUIRED} ${OPM_PARSER_QUIET})
endif ()
# get the prerequisite Boost libraries
if (NOT Boost_FOUND)
find_package(Boost 1.44.0
COMPONENTS filesystem date_time system unit_test_framework ${OPM_PARSER_QUIET})
COMPONENTS filesystem date_time system unit_test_framework
${opm-parser_FIND_REQUIRED} ${OPM_PARSER_QUIET})
endif ()
if (NOT Boost_FOUND)
if (NOT CJSON_FOUND OR NOT ERT_FOUND OR NOT Boost_FOUND)
set(opm-parser_FOUND "0")
else()
# setup list of all required libraries to link with opm-parser. notice that
@ -131,7 +130,8 @@ else()
${OPM_PARSER_LIBRARY}
${OPM_JSON_LIBRARY}
${CJSON_LIBRARIES}
${Boost_LIBRARIES})
${Boost_LIBRARIES}
${ERT_LIBRARIES})
# see if we can compile a minimum example
# CMake logical test doesn't handle lists (sic)
@ -152,7 +152,7 @@ int main (void) {
}" HAVE_OPM_PARSER)
cmake_pop_check_state ()
else ()
# clear the cache so the find probe is attempted again if files becomes
# clear the cache so the find probe is attempted again if files become
# available (only upon a unsuccessful *compile* should we disable further
# probing)
set (HAVE_OPM_PARSER)
@ -167,8 +167,7 @@ int main (void) {
DEFAULT_MSG
OPM_PARSER_INCLUDE_DIRS OPM_PARSER_LIBRARIES HAVE_OPM_PARSER
)
endif() # BOOST
endif() # cJSON
endif()
set (opm-parser_FOUND ${OPM_PARSER_FOUND})
if(OPM_PARSER_FOUND)

View File

@ -1,19 +0,0 @@
# -*- mode: cmake; tab-width: 2; indent-tabs-mode: t; truncate-lines: t; compile-command: "cmake -Wdev" -*-
# vim: set filetype=cmake autoindent tabstop=2 shiftwidth=2 noexpandtab softtabstop=2 nowrap:
# defines that must be present in config.h for our headers
set (opm-parser_CONFIG_VAR
HAVE_ERT
)
# dependencies
set (opm-parser_DEPS
# compile with C99 support if available
"C99"
# compile with C++0x/11 support if available
"CXX11Features REQUIRED"
# various runtime library enhancements
"Boost 1.44.0
COMPONENTS date_time filesystem system iostream unit_test_framework REQUIRED"
"cJSON"
)