allow the opm-parser test to fail

since the module currently calls the tests for cJSON and boost with
the REQUIRED flag set, cmake aborts completely even if opm-parser is
not REQUIRED. For modules which depend on opm-core that's currently a
non-issue because core has a requirement on parser, but the parser may
be useful for external projects as well, so we play nice.

Also, with this patch the config.h variable HAVE_OPM_PARSER is set...
This commit is contained in:
Andreas Lauser 2014-04-15 18:49:50 +02:00 committed by Bård Skaflestad
parent 9006824822
commit 99b4cf5067

View File

@ -105,15 +105,21 @@ find_library (OPM_JSON_LIBRARY
# get the prerequisite CJSON library # get the prerequisite CJSON library
if (NOT CJSON_FOUND) if (NOT CJSON_FOUND)
find_package (cjson REQUIRED ${OPM_PARSER_QUIET}) find_package (cjson ${OPM_PARSER_QUIET})
endif () endif ()
if (NOT CJSON_FOUND)
set(opm-parser_FOUND "0")
else()
# get the prerequisite Boost libraries # get the prerequisite Boost libraries
if (NOT Boost_FOUND) if (NOT Boost_FOUND)
find_package(Boost 1.44.0 find_package(Boost 1.44.0
COMPONENTS filesystem date_time system unit_test_framework REQUIRED ${OPM_PARSER_QUIET}) COMPONENTS filesystem date_time system unit_test_framework ${OPM_PARSER_QUIET})
endif () endif ()
if (NOT Boost_FOUND)
set(opm-parser_FOUND "0")
else()
# setup list of all required libraries to link with opm-parser. notice that # setup list of all required libraries to link with opm-parser. notice that
# we use the plural form to get *all* the libraries needed by cjson # we use the plural form to get *all* the libraries needed by cjson
set (OPM_PARSER_INCLUDE_DIRS set (OPM_PARSER_INCLUDE_DIRS
@ -161,4 +167,13 @@ find_package_handle_standard_args (OPM_PARSER
DEFAULT_MSG DEFAULT_MSG
OPM_PARSER_INCLUDE_DIRS OPM_PARSER_LIBRARIES HAVE_OPM_PARSER OPM_PARSER_INCLUDE_DIRS OPM_PARSER_LIBRARIES HAVE_OPM_PARSER
) )
endif() # BOOST
endif() # cJSON
set (opm-parser_FOUND ${OPM_PARSER_FOUND}) set (opm-parser_FOUND ${OPM_PARSER_FOUND})
if(OPM_PARSER_FOUND)
set (HAVE_OPM_PARSER "1")
else()
set (HAVE_OPM_PARSER "0")
endif()
set (opm-parser_CONFIG_VARS "HAVE_OPM_PARSER")