File FindQalculate-Use-FindPkgConfig.patch of Package step4
From aae4c90fa7f5e82b6a970b18c65898359241ba7e Mon Sep 17 00:00:00 2001
From: Heiko Becker <heirecka@exherbo.org>
Date: Fri, 1 May 2015 16:48:10 +0200
Subject: FindQalculate: Use FindPkgConfig instead of UsePkgConfig
The latter is deprecated and doesn't respect the PKG_CONFIG
environment variable which makes it easy to deal with differently
named pkg-config executables, e.g. arch-prefixed ones.
REVIEW: 123584
---
cmake/modules/FindQalculate.cmake | 42 +++++++++++++++++++++++++++++----------
step/CMakeLists.txt | 2 +-
2 files changed, 33 insertions(+), 11 deletions(-)
From d5412ebc25ab135c46fea283f4767492f7b3cc74 Mon Sep 17 00:00:00 2001
From: Antonio Rojas <arojas@archlinux.org>
Date: Tue, 29 Aug 2017 21:21:47 +0200
Subject: Don't search for and link to libcln when using libqalculate>=2.0
Step doesn't use any cln code directly, only via libqalculate. In version 2.0, libqalculate dropped cln in favor of gmp, so the cln dependency becomes unnecessary.
Differential Revision: https://phabricator.kde.org/D7588
---
cmake/modules/FindQalculate.cmake | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/cmake/modules/FindQalculate.cmake b/cmake/modules/FindQalculate.cmake
index 5e3f91b..dac26f0 100644
--- a/cmake/modules/FindQalculate.cmake
+++ b/cmake/modules/FindQalculate.cmake
@@ -22,21 +22,48 @@ if(QALCULATE_CFLAGS AND QALCULATE_LIBRARIES)
else(QALCULATE_CFLAGS AND QALCULATE_LIBRARIES)
if(NOT WIN32)
- include(UsePkgConfig)
+ include(FindPkgConfig)
if(QALCULATE_MIN_VERSION)
- exec_program(${PKGCONFIG_EXECUTABLE} ARGS libqalculate --atleast-version=${QALCULATE_MIN_VERSION} RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
+ pkg_check_modules(_pc_QALCULATE libqalculate>=${QALCULATE_MIN_VERSION})
else(QALCULATE_MIN_VERSION)
- exec_program(${PKGCONFIG_EXECUTABLE} ARGS libqalculate --exists RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
+ pkg_check_modules(_pc_QALCULATE libqalculate)
endif(QALCULATE_MIN_VERSION)
- if(_return_VALUE STREQUAL "0")
- exec_program(${PKGCONFIG_EXECUTABLE} ARGS libqalculate --libs OUTPUT_VARIABLE QALCULATE_LIBRARIES)
- exec_program(${PKGCONFIG_EXECUTABLE} ARGS cln --libs OUTPUT_VARIABLE CLN_LIBRARIES)
- exec_program(${PKGCONFIG_EXECUTABLE} ARGS libqalculate --cflags OUTPUT_VARIABLE QALCULATE_CFLAGS)
- set(QALCULATE_FOUND TRUE)
- message(STATUS "qalculate found and cln is:" ${CLN_LIBRARIES})
- endif(_return_VALUE STREQUAL "0")
+ if(_pc_QALCULATE_FOUND)
+ if(${_pc_QALCULATE_VERSION} VERSION_LESS 2.0.0)
+ pkg_check_modules(_pc_CLN cln)
+ endif()
+ set(QALCULATE_CFLAGS ${_pc_QALCULATE_CFLAGS})
+ endif(_pc_QALCULATE_FOUND)
+
+ find_library(QALCULATE_LIBRARIES
+ NAMES
+ qalculate
+ PATHS
+ ${_pc_QALCULATE_LIBRARY_DIRS}
+ ${LIB_INSTALL_DIR}
+ )
+
+ find_path(QALCULATE_INCLUDE_DIR
+ NAMES
+ libqalculate
+ PATHS
+ ${_pc_QALCULATE_INCLUDE_DIRS}
+ ${INCLUDE_INSTALL_DIR}
+ )
+
+ if(_pc_QALCULATE_FOUND)
+ if(${_pc_QALCULATE_VERSION} VERSION_LESS 2.0.0)
+ find_library(CLN_LIBRARIES
+ NAMES
+ cln
+ PATHS
+ ${_pc_CLN_LIBRARY_DIRS}
+ ${LIB_INSTALL_DIR}
+ )
+ endif()
+ endif()
else(NOT WIN32)
# XXX: currently no libqalculate on windows
diff --git a/step/CMakeLists.txt b/step/CMakeLists.txt
index 8783d91..f3f49f5 100644
--- a/step/CMakeLists.txt
+++ b/step/CMakeLists.txt
@@ -51,7 +51,7 @@ if(STEP_WITH_QALCULATE)
add_definitions(-DSTEP_WITH_UNITSCALC)
add_definitions(${QALCULATE_CFLAGS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
- set(qalculate_LIBS ${QALCULATE_LIBRARIES})
+ set(qalculate_LIBS ${QALCULATE_LIBRARIES} ${CLN_LIBRARIES})
endif(STEP_WITH_QALCULATE)
find_package(KDE4 REQUIRED)
--
cgit v0.11.2