From 09e58f7f33658fec6291213636989c715b32b7e2 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Wed, 2 Mar 2016 22:06:53 +0100 Subject: [PATCH] cmake: avoid using pkg_get_variable in FindIsoCodes.cmake pkg_get_variable is available only in CMake 3.4, which is too new. For now manually execute pkg-config to get the result of the variable needed. --- cmake/FindIsoCodes.cmake | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/cmake/FindIsoCodes.cmake b/cmake/FindIsoCodes.cmake index 5e3fa9698..2c102fe36 100644 --- a/cmake/FindIsoCodes.cmake +++ b/cmake/FindIsoCodes.cmake @@ -30,6 +30,22 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. +macro(_ISOCODES_GET_PKGCONFIG_VAR _outvar _varname) + execute_process( + COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_varname} iso-codes + OUTPUT_VARIABLE _result + RESULT_VARIABLE _null + ) + + if (_null) + else () + string(REGEX REPLACE "[\r\n]" " " _result "${_result}") + string(REGEX REPLACE " +$" "" _result "${_result}") + separate_arguments(_result) + set(${_outvar} ${_result} CACHE INTERNAL "") + endif () +endmacro () + find_package(PkgConfig) if (PkgConfig_FOUND) if (IsoCodes_MIN_VERSION) @@ -38,7 +54,7 @@ if (PkgConfig_FOUND) pkg_check_modules(_pc_ISOCODES iso-codes) endif () if (_pc_ISOCODES_FOUND) - pkg_get_variable(IsoCodes_DOMAINS iso-codes domains) + _isocodes_get_pkgconfig_var(IsoCodes_DOMAINS "domains") endif () endif ()