Commit Graph

19 Commits

Author SHA1 Message Date
Markus Blatt
2b87eecd68 Search for modules/packages each time a search is triggered.
This is essential if find package modules define imported
targets (usual for modern Cmake). Without this rerunning Cmake another
time in a non-clean build directory will abort with errors if imported
targets are used. E.g. with
```

CMake Error at /home/mblatt/src/dune/opm-2.9/opm-common/cmake/Modules/OpmSatellites.cmake:320 (add_executable):
  Target "test_mpiutil" links to target "ParMETIS::ParMETIS" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  CMakeLists.txt:308 (opm_add_test)

CMake Error at /home/mblatt/src/dune/opm-2.9/opm-common/cmake/Modules/OpmSatellites.cmake:320 (add_executable):
  Target "test_mpiutil" links to target "QuadMath::QuadMath" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  CMakeLists.txt:308 (opm_add_test)
```

This will result in multiple searches, but this should be rather fast
due their previous results being cached.
2022-10-11 20:50:46 +02:00
Markus Blatt
ff9792e31c Work around issues of Boost >=1.70.0 and CMake 3.18.4
With that combination the first search seems to happen in CONFIG mode
but subsequent searches will use MODULE mode. This will result in the
following warning:

CMake Warning at /usr/share/cmake-3.18/Modules/FindBoost.cmake:1187 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/share/cmake-3.18/Modules/FindBoost.cmake:1311 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.18/Modules/FindBoost.cmake:1919 (_Boost_MISSING_DEPENDENCIES)
  cmake/Modules/OpmFind.cmake:135 (find_package)
  cmake/Modules/OpmFind.cmake:230 (find_and_append_package_to)
  cmake/Modules/OpmLibMain.cmake:83 (find_and_append_package_list_to)
  CMakeLists.txt:222 (include)

Also the variable Boost_LIBRARIES will look quite messed up by
occurrences of optimized and debug:
Boost_LIBRARIES=optimized;/usr/lib/x86_64-linux-gnu/libboost_system.so.1.74.0;debug;/usr/lib/x86_64-linux-gnu/libboost_system.so;optimized;/usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.74.0;debug;/usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so

Which will make the modules unusable because of CMake errors during
linking:

CMake Error at /usr/share/dune/cmake/modules/DuneMacros.cmake:991 (target_link_libraries):
  The "debug" argument must be followed by a library.
Call Stack (most recent call first):
  src/CMakeLists.txt:2 (target_link_dune_default_libraries)
-- Configuring incomplete, errors occurred!

Note this fix is only needed for Boost versions 1.70 and higher.
Older versions do not provide cmake package configuration
files (BoostConfig.cmake) and hence there can be no mixup.

Note also that the alternative approach of setting
CMAKE_FIND_PACKAGE_PREFER_CONFIG does not work for OPM as with this
e.g. the Dune module versions would not be set correctly.
2021-06-15 21:04:41 +02:00
Markus Blatt
6d9a924930 Add -D qualifier to DEFINITIONS if missing for old CMake. 2021-03-17 15:36:24 +01:00
Markus Blatt
9452796c57 Send error for required but disabled packages.
When using CMAKE_DISABLE_FIND_PACKAGE_<name>=ON for a required package
CMake did not issue an errors since we never trigger the find_package
call. With this commit we now check whether such package is required
and send an error.
2020-05-20 14:55:52 +02:00
Markus Blatt
6707263385 DUNE does not need special treatment.
No need to set *_ROOT for it, which triggers a CMP0074 warning
as the policy settings do not survive find_package calls.
2020-04-15 14:17:53 +02:00
Arne Morten Kvarving
247b5685cc remove libecl from buildsystem, jenkins and packaging 2019-10-16 20:03:08 -05:00
Arne Morten Kvarving
41f18d718c changed: rename ewoms to opm-models 2019-08-23 08:29:28 +02:00
Markus Blatt
4a5333887b Research for software if we search for COMPONENTS.
Otherwise we will never search for e.g. Boost multiple
times and the upmost module in the hierarchy will dictate
the components to be used. That does not work for downstream
modules.

Therefore with this change we check whether there is an argument
COMPONENTS passed to find_package and make sure there will be
another call to it if that is the case.
2018-07-13 16:10:32 +02:00
Markus Blatt
563c053d3a Set only ecl_LIBRARIES and nothing else for ecl. 2018-07-12 12:25:21 +02:00
Markus Blatt
cbd44ff67a Remove unneeded opm_common_processed variable.
As we now process the prerequisites in the package configuration file
one search for opm-common is fully sufficient.
2018-07-12 12:25:21 +02:00
Markus Blatt
0e25c9f2e9 Always add ecl target to ecl_LIBRARIES.
Otherwise the flow binary does not know the correct
path to libecl in some situations.
2018-03-02 22:15:54 +01:00
Markus Blatt
3681fe0800 Support dune-uggrid (successor of UG). 2018-01-18 22:39:40 +01:00
Arne Morten Kvarving
9737538708 changed: get rid of find modules for opm modules
use pure config mode.

we no longer compile a test application for the libraries,
however checks have been tightened by making sure version of
all opm modules are the same.

this allows for putting prereqs directly in the module repositories
2017-12-20 11:12:01 +01:00
Markus Blatt
5662f2a188 Allow second search for opm-common to get all its dependencies and defines.
As opm-common is search in the toplevel CMakeLists.txt of each module in
config mode and the dependencies and defines are only processed in
opm_find_package(opm-common), we allow a second search using module mode
to trigger opm_find_package.
2017-10-13 21:20:30 +02:00
Markus Blatt
db0a52ffdb Force module mode in search for dune and opm even if *_DIR is set.
Otherwise some defines and macros will not be set as this is done
in opm_find_package. This might also make sense for dunecontrol
which always will set *_DIR.
2017-10-13 21:19:11 +02:00
Markus Blatt
fc4bac6b7a Suppress message "finding .. using module mode" for OPM modules. 2017-10-10 12:42:49 +02:00
Markus Blatt
7c779697c7 Deactivate package cache and activate sibling search for ecl.
Even though people are telling that ecl is already found using
sibling search it turned out that this statement is false. It
was always found using the CMake package cache. When installing
this lead to the installed package using ecl from the build tree.
With this commit we first try to find ecl without the package cache
but maybe using sibling search. Building installed packages no works
by setting -DSIBLING_SEARCH=Off -DCMAKE_INSTALL_PREFIX=/install/path
2017-10-06 22:36:40 +02:00
Atgeirr Flø Rasmussen
0eae093620 Rename dune-cornerpoint -> opm-grid. 2016-04-04 21:17:57 +02:00
Joakim Hove
c78f9d3862 Added cmake/ directory from opm-core 2015-03-18 14:48:36 +01:00