Merge pull request #2348 from blattms/external-fmtlib-2

Enable usage of fmtlib on the system.
This commit is contained in:
Markus Blatt 2021-03-15 13:26:23 +01:00 committed by GitHub
commit b7ce9c0fe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View File

@ -64,6 +64,20 @@ include(Findopm-tests)
# with the find module
include (${project}-prereqs)
if(ENABLE_ECL_INPUT)
# source_hook runs before config_hook and the former needs fmt, hence this
# needs to be here.
if(fmt_FOUND)
# OpmSatellites will not add the library, do it here.
list(APPEND opm-common_LIBRARIES fmt::fmt)
else()
add_definitions(-DFMT_HEADER_ONLY)
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/external/fmtlib/include)
# Not sure why this is needed.
list(APPEND EXTRA_INCLUDES ${PROJECT_SOURCE_DIR}/external/fmtlib/include)
endif()
endif()
# 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
include (CMakeLists_files.cmake)
@ -75,11 +89,7 @@ macro (config_hook)
endif()
# For this project
add_definitions(-DFMT_HEADER_ONLY)
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/external/fmtlib/include)
include_directories(${EXTRA_INCLUDES} ${PROJECT_BINARY_DIR}/include)
list(APPEND EXTRA_INCLUDES ${PROJECT_SOURCE_DIR}/external/fmtlib/include)
# For downstreams
list(APPEND EXTRA_INCLUDES ${PROJECT_BINARY_DIR}/include)
set(OPM_PROJECT_EXTRA_CODE_INTREE "${OPM_PROJECT_EXTRA_CODE_INTREE}

View File

@ -17,6 +17,10 @@ list(APPEND opm-common_DEPS
"Boost 1.44.0 COMPONENTS system unit_test_framework REQUIRED"
"OpenMP QUIET"
"cjson"
# Still it produces compile errors complaining that it
# cannot format UDQVarType. Hence we use the same version
# as the embedded one.
"fmt 7.0.3"
)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12.0")
list(APPEND opm-common_DEPS