Skip to content
Snippets Groups Projects

Remove PkgConfig dependence on Windows

Merged Ammar Nejati requested to merge removePkgConfigDep_Win into develop
2 files
+ 37
9
Compare changes
  • Side-by-side
  • Inline
Files
2
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
# FindPkgVersion.cmake
# --------------------
# description:
# Defines the function `find_pkg_version`, which obtains the version of a
# library from the `pkgconfig` (*.pc) files in a given path.
# This is currently used only under Windows, as a simple replacement for
# `PkgConfig` from MSYS2 platform.
#
# usage:
# find_pkg_version(<library-name> <config-filename> <search-paths> <output-var-name>)
#
# parameters:
# * library-name: name of the library (eg. "cerf")
# * config-filename: name of the package config file (eg. "libcerf.pc").
# If an empty string is given the default will be used:
# 'lib' + <library-name> + '.pc'
# eg. 'libcerf.pc'
# * search-paths: List of paths to search for the package config file.
# The file will be searched also within `pkgconfig` subfolder of the
# given paths.
# * output-var-name: Name of the output variable.
# If an empty string is given the default will be used:
# <library-name> + '_VERSION'
# eg. 'cerf_VERSION'
#
# output:
# The function pushes the following variables into the parent scope:
# * <library-name>_PATH: Path of the discovered package config file.
# * output-var-name: The version of the package.
#
# example:
# * Find the version of the 'cerf' package in the `CMAKE_LIBRARY_PATH` folders:
# find_pkg_version("cerf" "" "${CMAKE_LIBRARY_PATH}" Cerf_VERSION)
#
# copyright: 2021 Scientific Computing Group, Forschungszentrum Jülich GmbH
# Find a package version from a configuration file
function(findPkgVersion libname conffile paths output_var)
function(find_pkg_version libname conffile paths output_var)
string(STRIP "${paths}" _paths)
string(STRIP "${conffile}" _pkgconffile)
Loading