Bump minimum cmake version to 3.5

This version is available for all supported platforms and distros
(CentOS can have a version via EPEL, which is required anyway)

Advantages:
- one cmake version for all platforms
- we can drop all conditions based on cmake version
This commit is contained in:
Geert Janssens 2019-05-25 11:20:21 +02:00
parent ae76a29453
commit b7479e8fb0
14 changed files with 46 additions and 372 deletions

View File

@ -1,10 +1,6 @@
# CMakeLists.txt for GnuCash
if (WIN32 OR APPLE)
cmake_minimum_required (VERSION 3.3.2)
else()
cmake_minimum_required (VERSION 3.2)
endif()
cmake_minimum_required (VERSION 3.5)
project (gnucash)
@ -181,36 +177,31 @@ endif(WIN32)
find_package(PkgConfig REQUIRED)
# The default FindPkgConfig.make code has a bug in how the setting of PKG_CONFIG_PATH is handled.
# The common/cmake_modules/GncFindPkgConfig.cmake file overrides a couple of macros in FindPkgConfig to fix.
include (GncFindPkgConfig)
if (NOT PKG_CONFIG_FOUND)
message (SEND_ERROR "pkg-config not found, but is required")
endif (NOT PKG_CONFIG_FOUND)
# glib et al.
gnc_pkg_check_modules (GLIB2 REQUIRED glib-2.0>=2.40)
gnc_pkg_check_modules (GIO REQUIRED gio-2.0)
gnc_pkg_check_modules (GOBJECT REQUIRED gobject-2.0>=2.20)
gnc_pkg_check_modules (GMODULE REQUIRED gmodule-2.0>=2.20)
gnc_pkg_check_modules (GTHREAD REQUIRED gthread-2.0>=2.20)
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)
gnc_pkg_check_modules (LIBXML2 REQUIRED libxml-2.0>=2.7.0)
gnc_pkg_check_modules (LIBXSLT REQUIRED libxslt)
pkg_check_modules (LIBXML2 REQUIRED libxml-2.0>=2.7.0)
pkg_check_modules (LIBXSLT REQUIRED libxslt)
if (WITH_GNUCASH)
if (WIN32 OR APPLE)
gnc_pkg_check_modules (WEBKIT1 REQUIRED webkitgtk-3.0)
pkg_check_modules (WEBKIT1 REQUIRED webkitgtk-3.0)
set(WEBKIT1 1)
set(WEBKIT_CFLAGS ${WEBKIT2_CFLAGS})
set(WEBKIT_INCLUDE_DIRS ${WEBKIT1_INCLUDE_DIRS})
set(WEBKIT_LDFLAGS ${WEBKIT1_LDFLAGS})
set(WEBKIT_LIBRARIES ${WEBKIT1_LIBRARIES})
else (WIN32 OR APPLE)
gnc_pkg_check_modules (WEBKIT2_4 webkit2gtk-4.0)
pkg_check_modules (WEBKIT2_4 webkit2gtk-4.0)
if (NOT WEBKIT2_4_FOUND)
gnc_pkg_check_modules (WEBKIT2_3 REQUIRED webkit2gtk-3.0)
pkg_check_modules (WEBKIT2_3 REQUIRED webkit2gtk-3.0)
set(WEBKIT2_3 1)
set(WEBKIT_CFLAGS ${WEBKIT2_3_CFLAGS})
set(WEBKIT_INCLUDE_DIRS ${WEBKIT2_3_INCLUDE_DIRS})
@ -225,10 +216,10 @@ if (WITH_GNUCASH)
endif (NOT WEBKIT2_4_FOUND)
endif (WIN32 OR APPLE)
gnc_pkg_check_modules (GTK3 REQUIRED gtk+-3.0>=3.10.0)
pkg_check_modules (GTK3 REQUIRED gtk+-3.0>=3.10.0)
endif (WITH_GNUCASH)
gnc_pkg_check_modules (ZLIB REQUIRED zlib)
pkg_check_modules (ZLIB REQUIRED 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")
@ -295,7 +286,7 @@ endif()
# Look for guile versions in this order: 2.2 > 2.0
# guile library and include dir
gnc_pkg_check_modules (GUILE22 guile-2.2 QUIET)
pkg_check_modules (GUILE22 guile-2.2 QUIET)
if (GUILE22_FOUND) # found guile-2.2
add_definitions (-DHAVE_GUILE22)
set(HAVE_GUILE2 TRUE)
@ -310,7 +301,7 @@ if (GUILE22_FOUND) # found guile-2.2
message(STATUS "Using guile-2.2.x")
find_program (GUILE_EXECUTABLE NAMES guile2.2 guile)
else(GUILE22_FOUND)
gnc_pkg_check_modules (GUILE2 guile-2.0>=2.0.9 QUIET)
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)
@ -357,10 +348,10 @@ endif ()
# ############################################################
if (WITH_AQBANKING)
gnc_pkg_check_modules (GWENHYWFAR REQUIRED gwenhywfar>=4.9.99)
gnc_pkg_check_modules (AQBANKING REQUIRED aqbanking>=5.3.4)
pkg_check_modules (GWENHYWFAR REQUIRED gwenhywfar>=4.9.99)
pkg_check_modules (AQBANKING REQUIRED aqbanking>=5.3.4)
if(WITH_GNUCASH)
gnc_pkg_check_modules (GWEN_GTK3 gwengui-gtk3)
pkg_check_modules (GWEN_GTK3 gwengui-gtk3)
if(GWEN_GTK3_FOUND AND GWEN_GTK3_VERSION VERSION_GREATER "4.20.0")
set(HAVE_GWEN_GTK3 1 CACHE BOOL "True if gwen-gtk3.pc exists")
endif()
@ -368,7 +359,7 @@ if (WITH_AQBANKING)
endif (WITH_AQBANKING)
if (WITH_OFX)
gnc_pkg_check_modules (LIBOFX REQUIRED libofx)
pkg_check_modules (LIBOFX REQUIRED libofx)
include(CheckCXXSourceRuns)
if (WIN32)
set(CMAKE_REQUIRED_LIBRARIES "-L ${CMAKE_PREFIX_PATH}/libofx/lib -lofx")
@ -413,7 +404,7 @@ if(APPLE)
if(TARGET_RESULT STREQUAL "quartz")
set(GNC_PLATFORM_COCOA 1)
set(GDK_QUARTZ 1)
gnc_pkg_check_modules(GTK_MAC gtk-mac-integration-gtk3)
pkg_check_modules(GTK_MAC gtk-mac-integration-gtk3)
if (GTK_MAC_FOUND)
set(MAC_INTEGRATION 1)
find_library(COCOA_LIBRARY Cocoa)
@ -511,10 +502,10 @@ get_filename_component(PERL_DIR ${PERL_EXECUTABLE} DIRECTORY)
find_program(POD2MAN_EXECUTABLE pod2man HINTS ${PERL_DIR})
#ICU
gnc_pkg_check_modules (ICU4C REQUIRED icu-uc)
gnc_pkg_check_modules (ICU4C_I18N REQUIRED icu-i18n)
pkg_check_modules (ICU4C REQUIRED icu-uc)
pkg_check_modules (ICU4C_I18N REQUIRED icu-i18n)
GNC_PKG_CHECK_MODULES (LIBSECRET libsecret-1>=0.18)
pkg_check_modules (LIBSECRET libsecret-1>=0.18)
IF (LIBSECRET_FOUND)
SET (HAVE_LIBSECRET ON)
ENDIF (LIBSECRET_FOUND)

View File

@ -1,6 +1,6 @@
set(cmake_FILES GncAddGSchemaTargets.cmake GncAddSchemeTargets.cmake GncAddSwigCommand.cmake GncAddTest.cmake
GncFindPkgConfig.cmake MacroAddSourceFileCompileFlags.cmake MacroAppendForeach.cmake
MacroAddSourceFileCompileFlags.cmake MacroAppendForeach.cmake
MakeDist.cmake MakeDistFiles.cmake MakeDistCheck.cmake)
set_dist_list(cmake_modules_DIST CMakeLists.txt COPYING-CMAKE-SCRIPTS.txt ${cmake_FILES})

View File

@ -1,10 +1,6 @@
macro(add_gschema_targets _gschema_INPUTS)
set(_gschema_OUTPUTS "")
set(local_depends ${gschema_depends})
set(CMAKE_COMMAND_TMP "")
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
endif()
foreach(file ${_gschema_INPUTS})
set(_OUTPUT_FILE ${DATADIR_BUILD}/glib-2.0/schemas/${file})
@ -16,7 +12,7 @@ macro(add_gschema_targets _gschema_INPUTS)
list(APPEND _gschema_VALIDS ${_VALID_FILE})
add_custom_command(
OUTPUT ${_VALID_FILE}
COMMAND ${CMAKE_COMMAND_TMP}
COMMAND ${CMAKE_COMMAND} -E env
${GLIB_COMPILE_SCHEMAS} --strict --dry-run --schema-file=${_OUTPUT_FILE}
COMMAND ${CMAKE_COMMAND} -E touch ${_VALID_FILE}
DEPENDS ${_OUTPUT_FILE}

View File

@ -116,10 +116,6 @@ function(gnc_add_scheme_targets _TARGET _SOURCE_FILES _OUTPUT_DIR _GUILE_DEPENDS
if (__DEBUG)
message("add_custom_command: output = ${output_file}")
endif()
set(CMAKE_COMMMAND_TMP "")
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
endif()
if (MINGW64)
set(fpath "")
file(TO_CMAKE_PATH "$ENV{PATH}" fpath)
@ -151,7 +147,7 @@ function(gnc_add_scheme_targets _TARGET _SOURCE_FILES _OUTPUT_DIR _GUILE_DEPENDS
#We quote the arguments to stop CMake stripping the path separators.
add_custom_command(
OUTPUT ${output_file}
COMMAND ${CMAKE_COMMAND_TMP}
COMMAND ${CMAKE_COMMAND} -E env
"${LIBRARY_PATH}"
"GNC_UNINSTALLED=YES"
"GNC_BUILDDIR=\"${CMAKE_BINARY_DIR}\""

View File

@ -73,12 +73,8 @@ function(gnc_add_test _TARGET _SOURCE_FILES TEST_INCLUDE_VAR_NAME TEST_LIBS_VAR_
target_link_libraries(${_TARGET} ${TEST_LIBS})
target_include_directories(${_TARGET} PRIVATE ${TEST_INCLUDE_DIRS})
if (${HAVE_ENV_VARS})
set(CMAKE_COMMAND_TMP "")
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env "GNC_UNINSTALLED=YES;GNC_BUILDDIR=${CMAKE_BINARY_DIR};${ARGN}")
endif()
add_test(${_TARGET} ${CMAKE_COMMAND_TMP}
${CMAKE_BINARY_DIR}/bin/${_TARGET}
set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env "GNC_UNINSTALLED=YES;GNC_BUILDDIR=${CMAKE_BINARY_DIR};${ARGN}")
add_test(${_TARGET} ${CMAKE_COMMAND_TMP} ${CMAKE_BINARY_DIR}/bin/${_TARGET}
)
set_tests_properties(${_TARGET} PROPERTIES ENVIRONMENT "GNC_UNINSTALLED=YES;GNC_BUILDDIR=${CMAKE_BINARY_DIR};${ARGN}")
else()
@ -97,11 +93,7 @@ endfunction()
function(gnc_add_scheme_test _TARGET _SOURCE_FILE)
set(CMAKE_COMMAND_TMP "")
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
endif()
add_test(${_TARGET} ${CMAKE_COMMAND_TMP}
add_test(${_TARGET} ${CMAKE_COMMAND} -E env
${GUILE_EXECUTABLE} --debug -l ${CMAKE_CURRENT_SOURCE_DIR}/${_SOURCE_FILE} -c "(exit (run-test))"
)
get_guile_env()

View File

@ -1,256 +0,0 @@
if((${CMAKE_VERSION} VERSION_GREATER 3.1) AND (${CMAKE_VERSION} VERSION_LESS 3.5))
function (pkg_get_variable result pkg variable)
_pkgconfig_invoke("${pkg}" "prefix" "result" "" "--variable=${variable}")
set("${result}"
"${prefix_result}"
PARENT_SCOPE)
endfunction ()
macro(_gnc_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _prefix)
_pkgconfig_unset(${_prefix}_FOUND)
_pkgconfig_unset(${_prefix}_VERSION)
_pkgconfig_unset(${_prefix}_PREFIX)
_pkgconfig_unset(${_prefix}_INCLUDEDIR)
_pkgconfig_unset(${_prefix}_LIBDIR)
_pkgconfig_unset(${_prefix}_LIBS)
_pkgconfig_unset(${_prefix}_LIBS_L)
_pkgconfig_unset(${_prefix}_LIBS_PATHS)
_pkgconfig_unset(${_prefix}_LIBS_OTHER)
_pkgconfig_unset(${_prefix}_CFLAGS)
_pkgconfig_unset(${_prefix}_CFLAGS_I)
_pkgconfig_unset(${_prefix}_CFLAGS_OTHER)
_pkgconfig_unset(${_prefix}_STATIC_LIBDIR)
_pkgconfig_unset(${_prefix}_STATIC_LIBS)
_pkgconfig_unset(${_prefix}_STATIC_LIBS_L)
_pkgconfig_unset(${_prefix}_STATIC_LIBS_PATHS)
_pkgconfig_unset(${_prefix}_STATIC_LIBS_OTHER)
_pkgconfig_unset(${_prefix}_STATIC_CFLAGS)
_pkgconfig_unset(${_prefix}_STATIC_CFLAGS_I)
_pkgconfig_unset(${_prefix}_STATIC_CFLAGS_OTHER)
# create a better addressable variable of the modules and calculate its size
set(_pkg_check_modules_list ${ARGN})
list(LENGTH _pkg_check_modules_list _pkg_check_modules_cnt)
if(PKG_CONFIG_EXECUTABLE)
# give out status message telling checked module
if (NOT ${_is_silent})
if (_pkg_check_modules_cnt EQUAL 1)
message(STATUS "Checking for module '${_pkg_check_modules_list}'")
else()
message(STATUS "Checking for modules '${_pkg_check_modules_list}'")
endif()
endif()
set(_pkg_check_modules_packages)
set(_pkg_check_modules_failed)
set(_extra_paths)
if(NOT _no_cmake_path)
_pkgconfig_add_extra_path(_extra_paths CMAKE_PREFIX_PATH)
_pkgconfig_add_extra_path(_extra_paths CMAKE_FRAMEWORK_PATH)
_pkgconfig_add_extra_path(_extra_paths CMAKE_APPBUNDLE_PATH)
endif()
if(NOT _no_cmake_environment_path)
_pkgconfig_add_extra_path(_extra_paths ENV CMAKE_PREFIX_PATH)
_pkgconfig_add_extra_path(_extra_paths ENV CMAKE_FRAMEWORK_PATH)
_pkgconfig_add_extra_path(_extra_paths ENV CMAKE_APPBUNDLE_PATH)
endif()
if(NOT "${_extra_paths}" STREQUAL "")
# Save the PKG_CONFIG_PATH environment variable, and add paths
# from the CMAKE_PREFIX_PATH variables
set(_pkgconfig_path_old $ENV{PKG_CONFIG_PATH})
set(_pkgconfig_path ${_pkgconfig_path_old})
if(NOT "${_pkgconfig_path}" STREQUAL "")
file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path)
endif()
# Create a list of the possible pkgconfig subfolder (depending on
# the system
set(_lib_dirs)
if(NOT DEFINED CMAKE_SYSTEM_NAME
OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
AND NOT CMAKE_CROSSCOMPILING))
if(EXISTS "/etc/debian_version") # is this a debian system ?
if(CMAKE_LIBRARY_ARCHITECTURE)
list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
endif()
else()
# not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property
get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
if(uselib64)
list(APPEND _lib_dirs "lib64/pkgconfig")
endif()
endif()
endif()
list(APPEND _lib_dirs "lib/pkgconfig")
# Check if directories exist and eventually append them to the
# pkgconfig path list
foreach(_prefix_dir ${_extra_paths})
foreach(_lib_dir ${_lib_dirs})
if(EXISTS "${_prefix_dir}/${_lib_dir}")
list(APPEND _pkgconfig_path "${_prefix_dir}/${_lib_dir}")
list(REMOVE_DUPLICATES _pkgconfig_path)
endif()
endforeach()
endforeach()
# Prepare and set the environment variable
if(NOT "${_pkgconfig_path}" STREQUAL "")
# remove empty values from the list
list(REMOVE_ITEM _pkgconfig_path "")
file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)
if(UNIX)
string(REPLACE ";" ":" _pkgconfig_path "${_pkgconfig_path}")
string(REPLACE "\\ " " " _pkgconfig_path "${_pkgconfig_path}")
endif()
set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path}")
endif()
# Unset variables
unset(_lib_dirs)
unset(_pkgconfig_path)
endif()
# iterate through module list and check whether they exist and match the required version
foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
set(_pkg_check_modules_exist_query)
# check whether version is given
if (_pkg_check_modules_pkg MATCHES "(.*[^><])(>=|=|<=)(.*)")
set(_pkg_check_modules_pkg_name "${CMAKE_MATCH_1}")
set(_pkg_check_modules_pkg_op "${CMAKE_MATCH_2}")
set(_pkg_check_modules_pkg_ver "${CMAKE_MATCH_3}")
else()
set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
set(_pkg_check_modules_pkg_op)
set(_pkg_check_modules_pkg_ver)
endif()
# handle the operands
if (_pkg_check_modules_pkg_op STREQUAL ">=")
list(APPEND _pkg_check_modules_exist_query --atleast-version)
endif()
if (_pkg_check_modules_pkg_op STREQUAL "=")
list(APPEND _pkg_check_modules_exist_query --exact-version)
endif()
if (_pkg_check_modules_pkg_op STREQUAL "<=")
list(APPEND _pkg_check_modules_exist_query --max-version)
endif()
# create the final query which is of the format:
# * --atleast-version <version> <pkg-name>
# * --exact-version <version> <pkg-name>
# * --max-version <version> <pkg-name>
# * --exists <pkg-name>
if (_pkg_check_modules_pkg_op)
list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}")
else()
list(APPEND _pkg_check_modules_exist_query --exists)
endif()
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION)
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX)
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_INCLUDEDIR)
_pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_LIBDIR)
list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_name}")
list(APPEND _pkg_check_modules_packages "${_pkg_check_modules_pkg_name}")
# execute the query
execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query}
RESULT_VARIABLE _pkgconfig_retval)
# evaluate result and tell failures
if (_pkgconfig_retval)
if(NOT ${_is_silent})
message(STATUS " Package '${_pkg_check_modules_pkg}' not found")
endif()
set(_pkg_check_modules_failed 1)
endif()
endforeach()
if(_pkg_check_modules_failed)
# fail when requested
if (${_is_required})
message(FATAL_ERROR "A required package was not found")
endif ()
else()
# when we are here, we checked whether requested modules
# exist. Now, go through them and set variables
_pkgconfig_set(${_prefix}_FOUND 1)
list(LENGTH _pkg_check_modules_packages pkg_count)
# iterate through all modules again and set individual variables
foreach (_pkg_check_modules_pkg ${_pkg_check_modules_packages})
# handle case when there is only one package required
if (pkg_count EQUAL 1)
set(_pkg_check_prefix "${_prefix}")
else()
set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}")
endif()
_pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion )
pkg_get_variable("${_pkg_check_prefix}_PREFIX" ${_pkg_check_modules_pkg} "prefix")
pkg_get_variable("${_pkg_check_prefix}_INCLUDEDIR" ${_pkg_check_modules_pkg} "includedir")
pkg_get_variable("${_pkg_check_prefix}_LIBDIR" ${_pkg_check_modules_pkg} "libdir")
if (NOT ${_is_silent})
message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
endif ()
endforeach()
# set variables which are combined for multiple modules
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags )
_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other )
endif()
if(NOT "${_extra_paths}" STREQUAL "")
# Restore the environment variable
set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path_old})
endif()
unset(_extra_paths)
unset(_pkgconfig_path_old)
else()
if (${_is_required})
message(SEND_ERROR "pkg-config tool not found")
endif ()
endif()
endmacro()
macro(gnc_pkg_check_modules _prefix _module0)
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
_pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN})
_gnc_pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" ${_pkg_modules})
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
endif()
endmacro()
else()
include(FindPkgConfig)
macro(gnc_pkg_check_modules _prefix _module0)
PKG_CHECK_MODULES(${_prefix} ${_module0} ${ARGN})
endmacro()
endif()

View File

@ -15,11 +15,6 @@ include(${CMAKE_MODULE_PATH}/MakeDistFiles.cmake)
function(make_dist PACKAGE_PREFIX GNUCASH_SOURCE_DIR BUILD_SOURCE_DIR BUILDING_FROM_VCS)
set(CMAKE_COMMAND_TMP "")
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
endif()
# -- Remove any existing packaging directory.
file(REMOVE_RECURSE ${PACKAGE_PREFIX})
@ -68,7 +63,7 @@ function(make_dist PACKAGE_PREFIX GNUCASH_SOURCE_DIR BUILD_SOURCE_DIR BUILDING_F
COMMAND ${CMAKE_COMMAND} -E copy ${PACKAGE_PREFIX}.tar ${PACKAGE_PREFIX}.tar.save
)
execute_process_and_check_result(
COMMAND ${CMAKE_COMMAND_TMP} gzip -f ${PACKAGE_PREFIX}.tar
COMMAND ${CMAKE_COMMAND} -E env gzip -f ${PACKAGE_PREFIX}.tar
WORKING_DIRECTORY .
ERROR_MSG "gzip command to create ${PACKAGE_PREFIX}.tar.gz failed."
)
@ -78,7 +73,7 @@ function(make_dist PACKAGE_PREFIX GNUCASH_SOURCE_DIR BUILD_SOURCE_DIR BUILDING_F
COMMAND ${CMAKE_COMMAND} -E rename ${PACKAGE_PREFIX}.tar.save ${PACKAGE_PREFIX}.tar
)
execute_process_and_check_result(
COMMAND ${CMAKE_COMMAND_TMP} bzip2 -f ${PACKAGE_PREFIX}.tar
COMMAND ${CMAKE_COMMAND} -E env bzip2 -f ${PACKAGE_PREFIX}.tar
WORKING_DIRECTORY .
ERROR_MSG "bzip2 command to create ${PACKAGE_PREFIX}.tar.bz2 failed."
)

View File

@ -17,11 +17,6 @@ function(run_dist_check PACKAGE_PREFIX EXT)
set(TAR_OPTION "jxf")
endif()
set(MY_CMAKE_COMMAND "")
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
set(MY_CMAKE_COMMAND ${CMAKE_COMMAND} -E env)
endif()
FIND_PROGRAM(NINJA_COMMAND NAMES ninja ninja-build)
if (${NINJA_COMMAND} STREQUAL "NINJA_COMMAND-NOTFOUND")
message(FATAL_ERROR "Can't find the 'ninja' or 'ninja-build' program.")
@ -59,28 +54,28 @@ function(run_dist_check PACKAGE_PREFIX EXT)
# Run ninja in the build directory
execute_process_and_check_result(
COMMAND ${MY_CMAKE_COMMAND} ${NINJA_COMMAND}
COMMAND ${CMAKE_COMMAND} -E env ${NINJA_COMMAND}
WORKING_DIRECTORY ${BUILD_DIR}
ERROR_MSG "Ninja build failed."
)
# Run ninja install
execute_process_and_check_result(
COMMAND ${MY_CMAKE_COMMAND} ${NINJA_COMMAND} install
COMMAND ${CMAKE_COMMAND} -E env ${NINJA_COMMAND} install
WORKING_DIRECTORY ${BUILD_DIR}
ERROR_MSG "Ninja install failed."
)
# Run ninja check in the build directory
execute_process_and_check_result(
COMMAND ${MY_CMAKE_COMMAND} ${NINJA_COMMAND} check
COMMAND ${CMAKE_COMMAND} -E env ${NINJA_COMMAND} check
WORKING_DIRECTORY ${BUILD_DIR}
ERROR_MSG "Ninja check failed."
)
# Run ninja dist
execute_process_and_check_result(
COMMAND ${MY_CMAKE_COMMAND} ${NINJA_COMMAND} dist
COMMAND ${CMAKE_COMMAND} -E env ${NINJA_COMMAND} dist
WORKING_DIRECTORY ${BUILD_DIR}
ERROR_MSG "Ninja dist failed."
)

View File

@ -155,12 +155,6 @@ install(TARGETS gnc-gnome
# FIXME: where does LC_ALL=C come from?
set(CMAKE_COMMAND_TMP "")
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
endif()
if (${GETTEXT_VERSION_STRING} VERSION_LESS 0.19.6)
# Gettext is too old to be able to merge an appdata file.
# Fall back to providing an unmerged (and hence untranslated) appdata file.
@ -169,7 +163,7 @@ if (${GETTEXT_VERSION_STRING} VERSION_LESS 0.19.6)
else()
add_custom_command (
OUTPUT gnucash.appdata.xml
COMMAND ${CMAKE_COMMAND_TMP}
COMMAND ${CMAKE_COMMAND} -E env
LC_ALL=C
${GETTEXT_MSGFMT_EXECUTABLE}
--xml --template ${CMAKE_CURRENT_SOURCE_DIR}/gnucash.appdata.xml.in
@ -195,7 +189,7 @@ if (${GETTEXT_VERSION_STRING} VERSION_LESS 0.19)
else()
add_custom_command (
OUTPUT gnucash.desktop
COMMAND ${CMAKE_COMMAND_TMP}
COMMAND ${CMAKE_COMMAND} -E env
LC_ALL=C
${GETTEXT_MSGFMT_EXECUTABLE}
--desktop --template gnucash.desktop.in

View File

@ -23,14 +23,10 @@ add_gschema_targets("${gschema_SOURCES}")
# Handle gschemas.compiled
if (COMPILE_GSCHEMAS)
set(CMAKE_COMMAND_TMP "")
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
endif()
add_custom_command(
OUTPUT ${SCHEMADIR_BUILD}/gschemas.compiled
COMMAND ${CMAKE_COMMAND_TMP} ${GLIB_COMPILE_SCHEMAS} ${SCHEMADIR_BUILD}
COMMAND ${CMAKE_COMMAND} -E env ${GLIB_COMPILE_SCHEMAS} ${SCHEMADIR_BUILD}
DEPENDS ${gschema_depends}
)

View File

@ -90,18 +90,13 @@ add_xml_test(test-xml-transaction "${test_backend_xml_module_SOURCES};test-xml-t
add_xml_test(test-xml2-is-file "${test_backend_xml_module_SOURCES};test-xml2-is-file.cpp"
GNC_TEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/test-files/xml2)
set(CMAKE_COMMAND_TMP "")
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
endif()
set(test-real-data-env
SRCDIR=${CMAKE_CURRENT_SOURCE_DIR}
VERBOSE=yes
TEST_PATH=${CMAKE_BINARY_DIR}/bin
)
add_test(NAME test-real-data
COMMAND ${CMAKE_COMMAND_TMP}
COMMAND ${CMAKE_COMMAND} -E env
${SHELL} ${CMAKE_CURRENT_SOURCE_DIR}/test-real-data.sh
)
set_tests_properties(test-real-data PROPERTIES ENVIRONMENT "${test-real-data-env}")

View File

@ -33,20 +33,11 @@ file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" TEXI_BINARY_DIR)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/gnucash-design.texi" TEXI_SOURCE_FILE)
find_program(MAKEINFO makeinfo)
if (NOT ${MAKEINFO} STREQUAL "MAKEINFO-NOTFOUND")
if(${CMAKE_VERSION} VERSION_GREATER 3.1)
add_custom_command(
OUTPUT gnucash-design.info
COMMAND ${MAKEINFO} -I ${TEXI_BINARY_DIR} ${TEXI_SOURCE_FILE}
DEPENDS ${gnucash_design_TEXINFOS}
)
else()
add_custom_command(
OUTPUT gnucash-design.info
COMMAND ${MAKEINFO} -I ${TEXI_BINARY_DIR} ${TEXI_SOURCE_FILE}
DEPENDS ${gnucash_design_TEXINFOS}
)
endif()
add_custom_command(
OUTPUT gnucash-design.info
COMMAND ${MAKEINFO} -I ${TEXI_BINARY_DIR} ${TEXI_SOURCE_FILE}
DEPENDS ${gnucash_design_TEXINFOS}
)
endif (NOT ${MAKEINFO} STREQUAL "MAKEINFO-NOTFOUND")
dist_add_generated (${BUILDING_FROM_VCS} gnucash-design.info)

View File

@ -7,11 +7,6 @@ foreach(file gnc-fq-check.in gnc-fq-helper.in gnc-fq-update.in gnc-fq-dump)
list(APPEND _BIN_FILES ${_ABS_OUTPUT_FILE})
endforeach(file)
set(CMAKE_COMMAND_TMP "")
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
endif()
set(_MAN_FILES "")
foreach(file gnc-fq-dump gnc-fq-helper)
@ -20,8 +15,7 @@ foreach(file gnc-fq-dump gnc-fq-helper)
list(APPEND _MAN_FILES ${_MAN_OUTPUT})
add_custom_command(
OUTPUT ${_MAN_OUTPUT}
COMMAND
${CMAKE_COMMAND_TMP} ${PERL_EXECUTABLE} ${POD2MAN_EXECUTABLE} ${_POD_INPUT} ${_MAN_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E env ${PERL_EXECUTABLE} ${POD2MAN_EXECUTABLE} ${_POD_INPUT} ${_MAN_OUTPUT}
DEPENDS ${_POD_INPUT}
)
endforeach(file)

View File

@ -16,11 +16,6 @@ file (WRITE LINGUAS "${ALL_LINGUAS}")
set (CATALOGS "")
set (BUILD_CATALOGS "")
set(CMAKE_COMMAND_TMP "")
if (${CMAKE_VERSION} VERSION_GREATER 3.1)
set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
endif()
set(po_SOURCES "")
file (WRITE LINGUAS "")
foreach(lingua ${ALL_LINGUAS})
@ -37,7 +32,7 @@ foreach(lingua ${ALL_LINGUAS})
list(APPEND CATALOGS ${_OUTPUT_FILE})
add_custom_command(
OUTPUT ${_OUTPUT_FILE}
COMMAND ${CMAKE_COMMAND_TMP}
COMMAND ${CMAKE_COMMAND} -E env
${GETTEXT_MSGFMT_EXECUTABLE}
-o ${_OUTPUT_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${lingua}.po
)