Skip to content
Snippets Groups Projects
Commit 41a52ca1 authored by Santiago Ospina De Los Ríos's avatar Santiago Ospina De Los Ríos
Browse files

Merge branch 'feature/remove-pkg-config-from-cmake-find-pkg' into 'master'

Remove pkg-config branch on find_dune_package

See merge request !1394
parents 52eaab16 7244414f
Branches
Tags
1 merge request!1394Remove pkg-config branch on find_dune_package
Pipeline #72298 waiting for manual action
......@@ -89,6 +89,8 @@ In order to build the DUNE core modules you need at least the following software
## Build System
- Remove the search of (currently broken) `pkg-config` files for dune packages.
- Dune package dependencies are now transitively resolved at `find_package(<dune-module>)` calls instead of waiting
until the call to `dune_project()`. For example, a CMake call to `find_package(dune-grid)` will transitively
find the dune packages `dune-common`, `dune-geometry` and (if available) `dune-uggrid`. Note that the targets
......
......@@ -62,7 +62,6 @@ include_guard(GLOBAL)
include(DuneEnableAllPackages)
include(DuneModuleInformation)
include(DuneUtilities)
include(DunePkgConfig)
# checks that a module version is compatible with the found version of a module
# notice that this has the side effect of populating the ${module}_VERSION information
......@@ -258,54 +257,6 @@ macro(find_dune_package module)
endif()
find_package(${module} ${quiet})
endif()
if(NOT ${module}_FOUND AND NOT CMAKE_DISABLE_FIND_PACKAGE_${module})
message(STATUS "No full CMake package configuration support available."
" Falling back to pkg-config.")
# use pkg-config
find_package(PkgConfig)
if(NOT PKG_CONFIG_FOUND AND required)
message(FATAL_ERROR "Could not find module ${module}. We tried to use"
"pkg-config but could not find it. ")
endif()
pkg_check_modules (${module} ${required} ${module}${DUNE_FIND_VERSION})
set(${module}_FAKE_CMAKE_PKGCONFIG TRUE)
endif()
if(${module}_FAKE_CMAKE_PKGCONFIG)
# compute the path to the libraries
if(${module}_LIBRARIES)
unset(_module_lib)
foreach(lib ${${module}_LIBRARIES})
foreach(libdir ${${module}_LIBRARY_DIRS})
if(EXISTS ${libdir}/lib${lib}.a)
set(_module_lib ${libdir}/lib${lib}.a)
set(_module_lib_static "STATIC")
endif()
if(EXISTS ${libdir}/lib${lib}.so)
set(_module_lib ${libdir}/lib${lib}.so)
set(_module_lib_static "")
endif()
if(_module_lib)
#import library
add_library(${lib} ${_module_lib_static} IMPORTED)
set_property(TARGET ${lib} APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)
set_target_properties(${lib} PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES_NOCONFIG "CXX"
IMPORTED_LOCATION_NOCONFIG "${_module_lib}")
break()
endif()
endforeach()
endforeach()
endif()
if(NOT ${module}_MODULE_PATH)
if(${module}_INCLUDE_DIRS)
list(GET ${module}_INCLUDE_DIRS 0 _dir)
if(EXISTS ${_dir}/../share/dune/cmake/modules)
set(${module}_MODULE_PATH ${_dir}/../share/dune/cmake/modules)
endif()
endif()
endif()
unset(${module}_FAKE_CMAKE_PKGCONFIG)
endif()
if(${module}_FOUND)
# parse other module's dune.module file to generate variables for config.h
dune_check_module_version(${module} ${quiet} ${required} VERSION ${DUNE_FIND_VERSION})
......
......@@ -50,6 +50,7 @@ include(CMakePackageConfigHelpers)
include(DuneModuleDependencies)
include(DuneModuleInformation)
include(DuneSymlinkOrCopy)
include(DunePkgConfig)
include(DuneUtilities)
include(FeatureSummary)
include(GNUInstallDirs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment