mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Convert Gtk3 and Webkit to imported targets.
This causes CMake to include their headers with -isystem instead of -I, so the compiler doesn't generate warnings on them. ArchLinux was failing to build because of such warnings. Includes a function from cmake 3.6 to allow this to work on systems like Ubuntu 14.04 that still provide only cmake 3.5.
This commit is contained in:
parent
c23f3f05e3
commit
41c58ec00a
@ -196,7 +196,11 @@ find_package(PkgConfig REQUIRED)
|
||||
|
||||
if (NOT PKG_CONFIG_FOUND)
|
||||
message (SEND_ERROR "pkg-config not found, but is required")
|
||||
endif (NOT PKG_CONFIG_FOUND)
|
||||
endif (NOT PKG_CONFIG_FOUND)
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS 3.6)
|
||||
include(GncPkgConfig)
|
||||
endif()
|
||||
|
||||
# glib et al.
|
||||
pkg_check_modules (GLIB2 REQUIRED glib-2.0>=2.40)
|
||||
@ -209,31 +213,42 @@ pkg_check_modules (LIBXML2 REQUIRED libxml-2.0>=2.7.0)
|
||||
pkg_check_modules (LIBXSLT REQUIRED libxslt)
|
||||
if (WITH_GNUCASH)
|
||||
if (WIN32 OR APPLE)
|
||||
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})
|
||||
if (NOT CMAKE_VERSION VERSION_LESS 3.6)
|
||||
pkg_check_modules (WEBKIT REQUIRED IMPORTED_TARGET webkitgtk-3.0)
|
||||
else()
|
||||
pkg_check_modules (WEBKIT REQUIRED webkitgtk-3.0)
|
||||
endif()
|
||||
set(WEBKIT1 1 CACHE INTERNAL "WebKitGtk")
|
||||
_pkg_create_imp_target(WEBKIT)
|
||||
else (WIN32 OR APPLE)
|
||||
pkg_check_modules (WEBKIT2_4 webkit2gtk-4.0)
|
||||
if (NOT WEBKIT2_4_FOUND)
|
||||
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})
|
||||
set(WEBKIT_LDFLAGS ${WEBKIT2_3_LDFLAGS})
|
||||
set(WEBKIT_LIBRARIES ${WEBKIT2_3_LIBRARIES})
|
||||
else (NOT WEBKIT2_4_FOUND)
|
||||
set(WEBKIT2_4 1)
|
||||
set(WEBKIT_CFLAGS ${WEBKIT2_4_CFLAGS})
|
||||
set(WEBKIT_INCLUDE_DIRS ${WEBKIT2_4_INCLUDE_DIRS})
|
||||
set(WEBKIT_LDFLAGS ${WEBKIT2_4_LDFLAGS})
|
||||
set(WEBKIT_LIBRARIES ${WEBKIT2_4_LIBRARIES})
|
||||
endif (NOT WEBKIT2_4_FOUND)
|
||||
If (NOT CMAKE_VERSION VERSION_LESS 3.6)
|
||||
pkg_check_modules (WEBKIT IMPORTED_TARGET webkit2gtk-4.0)
|
||||
else()
|
||||
pkg_check_modules (WEBKIT webkit2gtk-4.0)
|
||||
endif()
|
||||
if (NOT WEBKIT_FOUND)
|
||||
if (NOT CMAKE_VERSION VERSION_LESS 3.6)
|
||||
pkg_check_modules (WEBKIT REQUIRED IMPORTED_TARGET webkit2gtk-3.0)
|
||||
else()
|
||||
pkg_check_modules (WEBKIT REQUIRED webkit2gtk-3.0)
|
||||
endif()
|
||||
set(WEBKIT2_3 1 CACHE INTERNAL "WebKit2Gtk3")
|
||||
else (NOT WEBKIT_FOUND)
|
||||
if (NOT WEBKIT2_3)
|
||||
set(WEBKIT2_4 1 CACHE INTERNAL "WebKit2Gtk4")
|
||||
endif(NOT WEBKIT2_3)
|
||||
endif (NOT WEBKIT_FOUND)
|
||||
if (CMAKE_VERSION VERSION_LESS 3.6)
|
||||
_pkg_create_imp_target(WEBKIT)
|
||||
endif()
|
||||
endif (WIN32 OR APPLE)
|
||||
|
||||
pkg_check_modules (GTK3 REQUIRED gtk+-3.0>=3.10.0)
|
||||
if (NOT CMAKE_VERSION VERSION_LESS 3.6)
|
||||
pkg_check_modules (GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0>=3.10.0)
|
||||
else()
|
||||
pkg_check_modules (GTK3 REQUIRED gtk+-3.0>=3.10.0)
|
||||
_pkg_create_imp_target(GTK3)
|
||||
endif()
|
||||
endif (WITH_GNUCASH)
|
||||
|
||||
pkg_check_modules (ZLIB REQUIRED zlib)
|
||||
|
52
common/cmake_modules/GncPkgConfig.cmake
Normal file
52
common/cmake_modules/GncPkgConfig.cmake
Normal file
@ -0,0 +1,52 @@
|
||||
#Pinched from FindPkgConfig in CMake 3.6 because we need to do this in
|
||||
#CMake 3.5. Delete this file and the corresponding calls in master
|
||||
#after merging up.
|
||||
|
||||
# given directories, and create an imported target from them
|
||||
function(_pkg_create_imp_target _prefix)
|
||||
unset(_libs)
|
||||
unset(_find_opts)
|
||||
|
||||
# set the options that are used as long as the .pc file does not provide a library
|
||||
# path to look into
|
||||
|
||||
foreach (flag IN LISTS ${_prefix}_LDFLAGS)
|
||||
if (flag MATCHES "^-L(.*)")
|
||||
# only look into the given paths from now on
|
||||
set(_find_opts "HINTS ${${CMAKE_MATCH_1}} NO_DEFAULT_PATH")
|
||||
continue()
|
||||
endif()
|
||||
if (flag MATCHES "^-l(.*)")
|
||||
set(_pkg_search "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
continue()
|
||||
endif()
|
||||
|
||||
find_library(pkgcfg_lib_${_prefix}_${_pkg_search}
|
||||
NAMES ${_pkg_search}
|
||||
${_find_opts})
|
||||
list(APPEND _libs "${pkgcfg_lib_${_prefix}_${_pkg_search}}")
|
||||
endforeach()
|
||||
|
||||
# only create the target if it is linkable, i.e. no executables
|
||||
if (NOT TARGET PkgConfig::${_prefix}
|
||||
AND ( ${_prefix}_INCLUDE_DIRS OR _libs OR ${_prefix}_CFLAGS_OTHER ))
|
||||
add_library(PkgConfig::${_prefix} INTERFACE IMPORTED)
|
||||
|
||||
unset(_props)
|
||||
if(${_prefix}_INCLUDE_DIRS)
|
||||
set_property(TARGET PkgConfig::${_prefix} PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${${_prefix}_INCLUDE_DIRS}")
|
||||
endif()
|
||||
if(_libs)
|
||||
set_property(TARGET PkgConfig::${_prefix} PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES "${_libs}")
|
||||
endif()
|
||||
if(${_prefix}_CFLAGS_OTHER)
|
||||
set_property(TARGET PkgConfig::${_prefix} PROPERTY
|
||||
INTERFACE_COMPILE_OPTIONS "${${_prefix}_CFLAGS_OTHER}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
@ -65,9 +65,9 @@ if (BUILDING_FROM_VCS)
|
||||
endif (BUILDING_FROM_VCS)
|
||||
|
||||
target_link_libraries (gnucash
|
||||
gncmod-ledger-core gncmod-report-gnome gnc-gnome gncmod-gnome-utils gncmod-app-utils
|
||||
gncmod-engine gnc-module gnc-core-utils gncmod-report-system
|
||||
${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GTK3_LDFLAGS} ${GTK_MAC_LDFLAGS}
|
||||
gncmod-ledger-core gncmod-report-gnome gnc-gnome gncmod-gnome-utils
|
||||
gncmod-app-utils gncmod-engine gnc-module gnc-core-utils gncmod-report-system
|
||||
PkgConfig::GTK3 ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS} ${GTK_MAC_LDFLAGS}
|
||||
)
|
||||
|
||||
# Get glib executable for generating the gresource file
|
||||
|
@ -46,7 +46,7 @@ add_library (gncmod-gnome-search
|
||||
${gnome_search_noinst_HEADERS}
|
||||
)
|
||||
|
||||
target_link_libraries(gncmod-gnome-search gncmod-gnome-utils ${GTK3_LDFLAGS})
|
||||
target_link_libraries(gncmod-gnome-search gncmod-gnome-utils PkgConfig::GTK3)
|
||||
|
||||
target_compile_definitions(gncmod-gnome-search PRIVATE -DG_LOG_DOMAIN=\"gnc.gui.search\")
|
||||
|
||||
|
@ -211,8 +211,8 @@ add_library (gncmod-gnome-utils
|
||||
${gnome_utils_noinst_HEADERS}
|
||||
)
|
||||
|
||||
target_link_libraries(gncmod-gnome-utils gncmod-app-utils gncmod-engine gnc-backend-xml-utils
|
||||
${CMAKE_DL_LIBS} ${GTK3_LDFLAGS} ${LIBSECRET_LDFLAGS} ${GTK_MAC_LDFLAGS})
|
||||
target_link_libraries(gncmod-gnome-utils gncmod-app-utils gncmod-engine gnc-backend-xml-utils ${GTK3_LDFLAGS}
|
||||
${CMAKE_DL_LIBS} ${LIBSECRET_LDFLAGS} ${GTK_MAC_LDFLAGS})
|
||||
|
||||
target_compile_options(gncmod-gnome-utils PRIVATE -Wno-deprecated-declarations)
|
||||
target_compile_definitions(gncmod-gnome-utils PUBLIC ${GTK_MAC_CFLAGS_OTHER}
|
||||
|
@ -16,7 +16,7 @@ set(GNOME_UTILS_GUI_TEST_INCLUDE_DIRS
|
||||
${CMAKE_BINARY_DIR}/common
|
||||
${CMAKE_SOURCE_DIR}/gnucash/gnome-utils
|
||||
${CMAKE_SOURCE_DIR}/libgnucash/engine
|
||||
${GTK3_INCLUDE_DIRS}
|
||||
# ${GTK3_INCLUDE_DIRS}
|
||||
)
|
||||
set(GNOME_UTILS_GUI_TEST_LIBS
|
||||
${GNOME_UTILS_TEST_LIBS}
|
||||
|
@ -125,7 +125,7 @@ set_source_files_properties (${gnc_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS ${CO
|
||||
|
||||
add_library (gnc-gnome ${gnc_gnome_SOURCES} ${gnc_gnome_noinst_HEADERS} ${SWIG_GNOME_C})
|
||||
target_link_libraries(gnc-gnome gncmod-gnome-search gncmod-ledger-core gncmod-report-gnome gncmod-report-system
|
||||
gncmod-register-gnome gncmod-register-core gncmod-gnome-utils gncmod-engine ${GTK3_LDFLAGS} ${GTK_MAC_LDFLAGS})
|
||||
gncmod-register-gnome gncmod-register-core gncmod-gnome-utils gncmod-engine PkgConfig::GTK3 ${GTK_MAC_LDFLAGS})
|
||||
|
||||
target_compile_definitions (gnc-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.gui\" ${GTK_MAC_CFLAGS_OTHER})
|
||||
target_compile_options(gnc-gnome PRIVATE -Wno-deprecated-declarations)
|
||||
|
@ -40,15 +40,14 @@ add_library (gncmod-html
|
||||
${html_HEADERS}
|
||||
)
|
||||
|
||||
target_link_libraries(gncmod-html gncmod-engine gnc-module gncmod-gnome-utils ${WEBKIT_LDFLAGS} ${GUILE_LDFLAGS})
|
||||
target_link_libraries(gncmod-html gncmod-engine gnc-module gncmod-gnome-utils
|
||||
PkgConfig::GTK3 PkgConfig::WEBKIT ${GUILE_LDFLAGS})
|
||||
|
||||
target_compile_definitions(gncmod-html PRIVATE -DG_LOG_DOMAIN=\"gnc.html\")
|
||||
|
||||
|
||||
target_include_directories (gncmod-html
|
||||
PUBLIC
|
||||
${GTK3_INCLUDE_DIRS}
|
||||
${WEBKIT_INCLUDE_DIRS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
|
@ -71,10 +71,10 @@ G_DEFINE_ABSTRACT_TYPE(GncHtml, gnc_html, GTK_TYPE_BIN)
|
||||
static void gnc_html_class_init( GncHtmlClass* klass );
|
||||
static void gnc_html_dispose( GObject* obj );
|
||||
static void gnc_html_finalize( GObject* obj );
|
||||
|
||||
//#define GNC_HTML_GET_PRIVATE(o) \
|
||||
/*
|
||||
#define GNC_HTML_GET_PRIVATE(o) \
|
||||
((GncHtmlPrivate*)g_type_instance_get_private((GTypeInstance*)o, GNC_TYPE_HTML))
|
||||
|
||||
*/
|
||||
#define GNC_HTML_GET_PRIVATE(o) (GNC_HTML(o)->priv)
|
||||
|
||||
#include "gnc-html-p.h"
|
||||
|
@ -51,7 +51,7 @@ add_library (gncmod-generic-import
|
||||
${generic_import_noinst_HEADERS}
|
||||
)
|
||||
|
||||
target_link_libraries(gncmod-generic-import gncmod-gnome-utils gncmod-engine ${GTK3_LDFLAGS} ${GLIB2_LDFLAGS})
|
||||
target_link_libraries(gncmod-generic-import gncmod-gnome-utils gncmod-engine PkgConfig::GTK3 ${GLIB2_LDFLAGS})
|
||||
|
||||
target_compile_definitions (gncmod-generic-import PRIVATE -DG_LOG_DOMAIN=\"gnc.import\")
|
||||
|
||||
|
@ -16,7 +16,7 @@ set(log_replay_noinst_HEADERS
|
||||
add_library(gncmod-log-replay ${log_replay_SOURCES} ${log_replay_noinst_HEADERS})
|
||||
|
||||
target_link_libraries(gncmod-log-replay gncmod-gnome-utils gncmod-app-utils gncmod-engine
|
||||
gnc-core-utils gnc-module ${GTK3_LDFLAGS})
|
||||
gnc-core-utils gnc-module PkgConfig::GTK3)
|
||||
|
||||
target_compile_definitions(gncmod-log-replay PRIVATE -DG_LOG_DOMAIN=\"gnc.import.log-replay\")
|
||||
|
||||
|
@ -43,7 +43,7 @@ set_source_files_properties (${ledger_core_SOURCES} PROPERTIES OBJECT_DEPENDS ${
|
||||
add_library (gncmod-ledger-core ${ledger_core_SOURCES} ${ledger_core_HEADERS})
|
||||
|
||||
target_link_libraries(gncmod-ledger-core gncmod-register-gnome gncmod-register-core gncmod-gnome-utils
|
||||
gncmod-engine gnc-core-utils ${GTK3_LDFLAGS})
|
||||
gncmod-engine gnc-core-utils PkgConfig::GTK3)
|
||||
|
||||
target_compile_definitions (gncmod-ledger-core PRIVATE -DG_LOG_DOMAIN=\"gnc.register.ledger\")
|
||||
|
||||
|
@ -55,13 +55,13 @@ set_source_files_properties (${register_gnome_SOURCES} PROPERTIES OBJECT_DEPENDS
|
||||
|
||||
add_library (gncmod-register-gnome ${register_gnome_SOURCES} ${register_gnome_noinst_HEADERS})
|
||||
|
||||
target_link_libraries(gncmod-register-gnome gncmod-register-core ${GTK3_LDFLAGS})
|
||||
target_link_libraries(gncmod-register-gnome gncmod-register-core PkgConfig::GTK3)
|
||||
|
||||
target_compile_definitions(gncmod-register-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.register.gnome\")
|
||||
|
||||
target_include_directories(gncmod-register-gnome
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE ${CMAKE_SOURCE_DIR}/gnucash/register/ledger-core ${GTK3_INCLUDE_DIRS}
|
||||
PRIVATE ${CMAKE_SOURCE_DIR}/gnucash/register/ledger-core
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
|
@ -29,7 +29,7 @@ add_library (gncmod-report-gnome
|
||||
${SWIG_REPORT_GNOME_C}
|
||||
)
|
||||
target_link_libraries(gncmod-report-gnome gncmod-report-system gncmod-html gncmod-gnome-utils
|
||||
${GUILE_LDFLAGS} ${GTK3_LDFLAGS})
|
||||
PkgConfig::GTK3 ${GUILE_LDFLAGS} )
|
||||
|
||||
target_compile_definitions (gncmod-report-gnome PRIVATE -DG_LOG_DOMAIN=\"gnc.report.gui\")
|
||||
target_compile_options(gncmod-report-gnome PRIVATE -Wno-deprecated-declarations)
|
||||
|
@ -23,10 +23,10 @@ add_library (gncmod-report-system
|
||||
|
||||
target_compile_definitions(gncmod-report-system PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\")
|
||||
|
||||
target_link_libraries(gncmod-report-system gnc-module gncmod-app-utils ${GTK3_LDFLAGS} ${GUILE_LDFLAGS})
|
||||
target_link_libraries(gncmod-report-system gnc-module gncmod-app-utils PkgConfig::GTK3 ${GUILE_LDFLAGS})
|
||||
|
||||
target_include_directories (gncmod-report-system
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${GTK3_INCLUDE_DIRS}
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@ set(stylesheets_noinst_HEADERS
|
||||
add_library(gncmod-stylesheets MODULE ${stylesheets_SOURCES} ${stylesheets_noinst_HEADERS})
|
||||
|
||||
target_link_libraries(gncmod-stylesheets gncmod-report-gnome gncmod-report-system gncmod-gnome-utils gnc-module
|
||||
${GUILE_LDFLAGS} ${GTK3_LDFLAGS} ${GLIB2_LDFLAGS})
|
||||
PkgConfig::GTK3 ${GUILE_LDFLAGS} ${GLIB2_LDFLAGS})
|
||||
|
||||
target_compile_definitions(gncmod-stylesheets PRIVATE -DG_LOG_DOMAIN=\"gnc.report.core\")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user