More conversions from pkg-config variables to imported targets.

Also converts ICU detection from pkgconfig to FindICU.
This commit is contained in:
John Ralls
2019-09-13 17:02:41 -07:00
parent e4eedfe662
commit 1a9fcfefad
36 changed files with 90 additions and 142 deletions

View File

@@ -199,14 +199,14 @@ if (NOT PKG_CONFIG_FOUND)
endif (NOT PKG_CONFIG_FOUND)
# glib et al.
pkg_check_modules (GLIB2 REQUIRED glib-2.0>=2.40)
pkg_check_modules (GIO REQUIRED gio-2.0)
pkg_check_modules (GOBJECT REQUIRED gobject-2.0>=2.20)
pkg_check_modules (GMODULE REQUIRED gmodule-2.0>=2.20)
pkg_check_modules (GTHREAD REQUIRED gthread-2.0>=2.20)
pkg_check_modules (GLIB2 REQUIRED IMPORTED_TARGET glib-2.0>=2.40)
pkg_check_modules (GIO REQUIRED IMPORTED_TARGET gio-2.0)
pkg_check_modules (GOBJECT REQUIRED IMPORTED_TARGET gobject-2.0>=2.20)
pkg_check_modules (GMODULE REQUIRED IMPORTED_TARGET gmodule-2.0>=2.20)
pkg_check_modules (GTHREAD REQUIRED IMPORTED_TARGET gthread-2.0>=2.20)
pkg_check_modules (LIBXML2 REQUIRED libxml-2.0>=2.7.0)
pkg_check_modules (LIBXSLT REQUIRED libxslt)
pkg_check_modules (LIBXML2 REQUIRED IMPORTED_TARGET libxml-2.0>=2.7.0)
pkg_check_modules (LIBXSLT REQUIRED IMPORTED_TARGET libxslt)
if (WITH_GNUCASH)
if (WIN32 OR APPLE)
pkg_check_modules (WEBKIT REQUIRED IMPORTED_TARGET webkitgtk-3.0)
@@ -226,7 +226,7 @@ if (WITH_GNUCASH)
pkg_check_modules (GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0>=3.18.0)
endif (WITH_GNUCASH)
pkg_check_modules (ZLIB REQUIRED zlib)
pkg_check_modules (ZLIB REQUIRED IMPORTED_TARGET zlib)
if (MSVC)
message (STATUS "Hint: To create the import libraries for the gnome DLLs (e.g. gconf-2.lib), use the dlltool as follows: pexports bin/libgconf-2-4.dll > lib/libgconf-2.def ; dlltool -d lib/libgconf-2.def -D bin/libgconf-2-4.dll -l lib/gconf-2.lib")
@@ -293,42 +293,23 @@ endif()
# Look for guile versions in this order: 2.2 > 2.0
# guile library and include dir
pkg_check_modules (GUILE22 guile-2.2 QUIET)
if (GUILE22_FOUND) # found guile-2.2
add_definitions (-DHAVE_GUILE22)
set(HAVE_GUILE2 TRUE)
set(GUILE_EFFECTIVE_VERSION 2.2)
set(GUILE_INCLUDE_DIRS ${GUILE22_INCLUDE_DIRS})
set(GUILE_LDFLAGS ${GUILE22_LDFLAGS})
find_program (GUILD_EXECUTABLE NAMES guild2.2 guild)
if (NOT GUILD_EXECUTABLE)
message (SEND_ERROR "The guild executable was not found, but is required. Please set GUILD_EXECUTABLE.")
endif (NOT GUILD_EXECUTABLE)
message(STATUS "Using guile-2.2.x")
find_program (GUILE_EXECUTABLE NAMES guile2.2 guile)
else(GUILE22_FOUND)
pkg_check_modules (GUILE2 guile-2.0>=2.0.9 QUIET)
if (GUILE2_FOUND) # found guile-2.0
add_definitions (-DHAVE_GUILE20)
set(HAVE_GUILE2 TRUE)
set(GUILE_EFFECTIVE_VERSION 2.0)
set(GUILE_INCLUDE_DIRS ${GUILE2_INCLUDE_DIRS})
set(GUILE_LDFLAGS ${GUILE2_LDFLAGS})
find_program (GUILD_EXECUTABLE NAMES guild2.0 guild)
if (NOT GUILD_EXECUTABLE)
message (SEND_ERROR "The guild executable was not found, but is required. Please set GUILD_EXECUTABLE.")
endif (NOT GUILD_EXECUTABLE)
pkg_check_modules (GUILE IMPORTED_TARGET guile-2.2 QUIET)
if (GUILE_FOUND)
if (NOT GUILE_EFFECTIVE_VERSION) # found guile-2.2
set(GUILE_EFFECTIVE_VERSION 2.2)
endif()
else(GUILE_FOUND)
pkg_check_modules (GUILE REQUIRED IMPORTED_TARGET guile-2.0>=2.0.9 QUIET)
set(GUILE_EFFECTIVE_VERSION 2.0)
endif(GUILE_FOUND)
find_program (GUILD_EXECUTABLE NAMES guild2.2 guild2.0 guild)
if (NOT GUILD_EXECUTABLE)
message (SEND_ERROR "The guild executable was not found, but is required.")
endif (NOT GUILD_EXECUTABLE)
message(STATUS "Using guile-2.0.x")
find_program (GUILE_EXECUTABLE NAMES guile2.0 guile)
else(GUILE2_FOUND)
message (FATAL_ERROR "Neither guile 2.2 nor guile 2.0 were found GnuCash can't run without one of them. Ensure that one is installed and can be found with pkg-config.")
endif(GUILE2_FOUND)
endif(GUILE22_FOUND)
find_program (GUILE_EXECUTABLE NAMES guile2.2 guile2.0 guile)
if (NOT GUILE_EXECUTABLE)
message (SEND_ERROR "The guile executable was not found, but is required. Please set GUILE_EXECUTABLE.")
message (SEND_ERROR "The guile executable was not found, but is required.")
endif (NOT GUILE_EXECUTABLE)
# Test that guile has SRFI-64. This is required for some unit tests.
@@ -358,8 +339,8 @@ find_guile_dirs()
# ############################################################
if (WITH_AQBANKING)
pkg_check_modules (GWENHYWFAR REQUIRED gwenhywfar>=4.9.99)
pkg_check_modules (AQBANKING REQUIRED aqbanking>=5.3.4)
pkg_check_modules (GWENHYWFAR REQUIRED IMPORTED_TARGET gwenhywfar>=4.9.99)
pkg_check_modules (AQBANKING REQUIRED IMPORTED_TARGET aqbanking>=5.3.4)
set(CMAKE_REQUIRED_INCLUDES "${AQBANKING_INCLUDE_DIRS}"
"${GWENHYWFAR_INCLUDE_DIRS}")
set(CMAKE_REQUIRED_LIBRARIES "-laqbanking")
@@ -376,7 +357,7 @@ if (WITH_AQBANKING)
endif (WITH_AQBANKING)
if (WITH_OFX)
pkg_check_modules (LIBOFX REQUIRED libofx)
pkg_check_modules (LIBOFX REQUIRED IMPORTED_TARGET libofx)
include(CheckCXXSourceRuns)
if (WIN32)
set(CMAKE_REQUIRED_LIBRARIES "-L ${CMAKE_PREFIX_PATH}/libofx/lib -lofx")
@@ -519,10 +500,9 @@ get_filename_component(PERL_DIR ${PERL_EXECUTABLE} DIRECTORY)
find_program(POD2MAN_EXECUTABLE pod2man HINTS ${PERL_DIR})
#ICU
pkg_check_modules (ICU4C REQUIRED icu-uc)
pkg_check_modules (ICU4C_I18N REQUIRED icu-i18n)
find_package(ICU REQUIRED COMPONENTS i18n uc)
pkg_check_modules (LIBSECRET libsecret-1>=0.18)
pkg_check_modules (LIBSECRET IMPORTED_TARGET libsecret-1>=0.18)
IF (LIBSECRET_FOUND)
SET (HAVE_LIBSECRET ON)
ENDIF (LIBSECRET_FOUND)