From d33554b5ed481b06beca09c78b7d4427ad135f30 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Fri, 6 Mar 2015 09:40:08 +0100 Subject: Replace dashes with underscores in pkg-config --- common/cmake/PkgConfigVars.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/common/cmake/PkgConfigVars.cmake b/common/cmake/PkgConfigVars.cmake index fcb7bc6..f295457 100644 --- a/common/cmake/PkgConfigVars.cmake +++ b/common/cmake/PkgConfigVars.cmake @@ -1,8 +1,24 @@ +# - determine variables defined in pkg-config files +# +# Usage: +# pkg_check_variable( ) +# +# Checks for a variable in the given package and translates to a call such as +# `pkg-config --variable= `. The output is a cached +# variable named +# +# _ +# +# Note that both names are uppercased and any dashes replaced by underscores. +# + find_package(PkgConfig REQUIRED) function(pkg_check_variable _pkg _name) string(TOUPPER ${_pkg} _pkg_upper) string(TOUPPER ${_name} _name_upper) + string(REPLACE "-" "_" _pkg_upper ${_pkg_upper}) + string(REPLACE "-" "_" _name_upper ${_name_upper}) set(_output_name "${_pkg_upper}_${_name_upper}") execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_name} ${_pkg} -- cgit v1.2.3