diff options
-rw-r--r-- | CMakeLists.txt | 49 | ||||
-rw-r--r-- | cmake/modules/FindGLib.cmake | 17 | ||||
-rw-r--r-- | cmake/modules/FindGObjectIntrospection.cmake | 29 | ||||
-rw-r--r-- | cmake/modules/FindLibXML.cmake | 19 |
4 files changed, 65 insertions, 49 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f7ec5cb..4ac68c48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,7 +129,7 @@ if(WITH_CXX_BINDINGS) else() message(STATUS "Warning: Building the C++ bindings is not possible since a C++ compiler could not be found. " - "Turning-off C++ bindings" + "Turning-off C++ bindings." ) set(WITH_CXX_BINDINGS False) endif() @@ -313,7 +313,7 @@ if(WIN32 OR WINCE) #Always use builtin tzdata on Windows systems. if(NOT USE_BUILTIN_TZDATA) message(STATUS - "Currently unable to use system tzdata on Windows. Falling back to builtin tzdata" + "Currently unable to use system tzdata on Windows. Falling back to builtin tzdata." ) set(USE_BUILTIN_TZDATA 1) endif() @@ -329,6 +329,11 @@ set(INSTALL_TARGETS_DEFAULT_ARGS ARCHIVE DESTINATION ${LIB_INSTALL_DIR} ) +#Look for PkgConfig +#if not found then cannot proceed for GLib+LibXML or GObjectIntrospection. +#(unless/until they can be handled without pkg-config some day) +find_package(PkgConfig QUIET) + set(MIN_GOBJECT_INTROSPECTION "0.6.7") option(GOBJECT_INTROSPECTION "Build GObject introspection \"typelib\" files. Requires GObject Introspection development package ${MIN_GOBJECT_INTROSPECTION} or higher.") add_feature_info( @@ -337,6 +342,13 @@ add_feature_info( "build GObject introspection \"typelib\" files" ) if(GOBJECT_INTROSPECTION) + if(NOT PKG_CONFIG_FOUND) + message(FATAL_ERROR + "You are attempting to build with GObject Introspection enabled, however that option is " + "not supported unless pkg-config can be found. Please install pkg-config and try again. " + "You can disable GObject Introspection by passing -DGOBJECT_INTROSPECTION=False to cmake.") + endif() + find_package(GObjectIntrospection ${MIN_GOBJECT_INTROSPECTION}) set_package_properties(GObjectIntrospection PROPERTIES TYPE OPTIONAL @@ -378,24 +390,21 @@ if(ICAL_GLIB_VAPI) if(NOT GOBJECT_INTROSPECTION) message(FATAL_ERROR "You requested to build the Vala vapi but have not enabled the GObject Introspection. " - "Please try again also passing -DGOBJECT_INTROSPECTION=True to cmake" - ) + "Please try again also passing -DGOBJECT_INTROSPECTION=True to cmake.") endif() find_program(VALAC valac DOC "the Vala compiler") if(NOT VALAC) message(FATAL_ERROR "valac, the Vala compiler was not found. " - "Install it or disable Vala bindings with -DICAL_GLIB_VAPI=False" - ) + "Install it or disable Vala bindings with -DICAL_GLIB_VAPI=False.") endif() find_program(VAPIGEN vapigen DOC "tool to generate the Vala API") if(NOT VAPIGEN) message(FATAL_ERROR "vapigen, the tool for generating the Vala API was not found. " - "Install it or disable Vala bindings with -DICAL_GLIB_VAPI=False" - ) + "Install it or disable Vala bindings with -DICAL_GLIB_VAPI=False.") endif() endif() @@ -408,6 +417,13 @@ add_feature_info( "build libical-glib interface" ) if(ICAL_GLIB) + if(NOT PKG_CONFIG_FOUND) + message(FATAL_ERROR + "You requested to build libical-glib, however that option is not supported " + "unless pkg-config can be found. Please install pkg-config and try again. " + "Alternatively, disable the libical-glib build (by passing -DICAL_GLIB=False to cmake).") + endif() + find_package(GLib ${MIN_GLIB}) set_package_properties(GLib PROPERTIES TYPE OPTIONAL @@ -426,21 +442,18 @@ if(ICAL_GLIB) message(FATAL_ERROR "You requested to build libical-glib, but the necessary development package " "is missing or too low a version (libxml ${MIN_LIBXML} or higher is required). " - "Alternatively, disable the libical-glib build (by passing -DICAL_GLIB=False to cmake)" - ) + "Alternatively, disable the libical-glib build (by passing -DICAL_GLIB=False to cmake).") elseif(LIBXML_FOUND) message(FATAL_ERROR "You requested to build libical-glib, but the necessary development package " "is missing or too low a version (glib ${MIN_GLIB} or higher is required. " - "Alternatively, disable the libical-glib build (by passing -DICAL_GLIB=False to cmake)" - ) + "Alternatively, disable the libical-glib build (by passing -DICAL_GLIB=False to cmake).") else() message(FATAL_ERROR "You requested to build libical-glib, but the necessary development packages " "are missing or too low a version " "(glib ${MIN_GLIB} and libxml ${MIN_LIBXML} or higher are required). " - "Alternatively, disable the libical-glib build (by passing -DICAL_GLIB=False to cmake)" - ) + "Alternatively, disable the libical-glib build (by passing -DICAL_GLIB=False to cmake).") endif() endif() @@ -539,14 +552,14 @@ if(ADDRESS_SANITIZER) if(GOBJECT_INTROSPECTION) message(STATUS "Warning: Building the address sanitizer with GObject Introspection is is not supported. " - "Turning-off GObject Introspection" + "Turning-off GObject Introspection." ) set(HAVE_INTROSPECTION False) endif() if(ICAL_GLIB) message(STATUS "Warning: Building the address sanitizer with the GObject interface is not supported. " - "Turning-off the GObject interface" + "Turning-off the GObject interface." ) set(ICAL_GLIB False) endif() @@ -565,14 +578,14 @@ if(THREAD_SANITIZER) if(GOBJECT_INTROSPECTION) message(STATUS "Warning: Building the thread sanitizer with GObject Introspection is is not supported. " - "Turning-off GObject Introspection" + "Turning-off GObject Introspection." ) set(HAVE_INTROSPECTION False) endif() if(ICAL_GLIB) message(STATUS "Warning: Building the thread sanitizer with the GObject interface is not supported. " - "Turning-off the GObject interface" + "Turning-off the GObject interface." ) set(ICAL_GLIB False) endif() diff --git a/cmake/modules/FindGLib.cmake b/cmake/modules/FindGLib.cmake index f2397eb4..9d075967 100644 --- a/cmake/modules/FindGLib.cmake +++ b/cmake/modules/FindGLib.cmake @@ -13,14 +13,15 @@ set_package_properties(GLib PROPERTIES find_package(PkgConfig) if(PKG_CONFIG_FOUND) - if(PACKAGE_FIND_VERSION_COUNT GREATER 0) - set(_glib_version_cmp ">=${PACKAGE_FIND_VERSION}") - endif() - pkg_check_modules(_pc_glib glib-2.0${_glib_version_cmp} gobject-2.0${_glib_version_cmp}) - if(_pc_glib_FOUND) - set(GLIB_FOUND TRUE) - set(GLIB_CFLAGS "${_pc_glib_CFLAGS}") - set(GLIB_LIBRARIES "${_pc_glib_LDFLAGS}") + if(DEFINED GLib_FIND_VERSION) + set(_glib_version_cmp ${GLib_FIND_VERSION}) + set(_glib_version_cmp ">=${_glib_version_cmp}") + pkg_check_modules(_pc_glib glib-2.0${_glib_version_cmp} gobject-2.0${_glib_version_cmp}) + if(_pc_glib_FOUND) + set(GLIB_FOUND TRUE) + set(GLIB_CFLAGS "${_pc_glib_CFLAGS}") + set(GLIB_LIBRARIES "${_pc_glib_LDFLAGS}") + endif() endif() endif() diff --git a/cmake/modules/FindGObjectIntrospection.cmake b/cmake/modules/FindGObjectIntrospection.cmake index eb014bb4..262c7025 100644 --- a/cmake/modules/FindGObjectIntrospection.cmake +++ b/cmake/modules/FindGObjectIntrospection.cmake @@ -1,4 +1,4 @@ -# - try to find gobject-introspection +# - try to find gobject-introspection 1.0 # # Once done this will define # @@ -34,19 +34,20 @@ endmacro(_GIR_GET_PKGCONFIG_VAR) find_package(PkgConfig) if(PKG_CONFIG_FOUND) - if(PACKAGE_FIND_VERSION_COUNT GREATER 0) - set(_gir_version_cmp ">=${PACKAGE_FIND_VERSION}") - endif() - pkg_check_modules(_pc_gir gobject-introspection-1.0${_gir_version_cmp}) - if(_pc_gir_FOUND) - set(GObjectIntrospection_FOUND TRUE) - _gir_get_pkgconfig_var(GObjectIntrospection_SCANNER "g_ir_scanner") - _gir_get_pkgconfig_var(GObjectIntrospection_COMPILER "g_ir_compiler") - _gir_get_pkgconfig_var(GObjectIntrospection_GENERATE "g_ir_generate") - _gir_get_pkgconfig_var(GObjectIntrospection_GIRDIR "girdir") - _gir_get_pkgconfig_var(GObjectIntrospection_TYPELIBDIR "typelibdir") - set(GObjectIntrospection_CFLAGS "${_pc_gir_CFLAGS}") - set(GObjectIntrospection_LIBS "${_pc_gir_LIBS}") + if(DEFINED GObjectIntrospection_FIND_VERSION) + set(_gir_version_cmp "${GObjectIntrospection_FIND_VERSION}") + set(_gir_version_cmp ">=${_gir_version_cmp}") + pkg_check_modules(_pc_gir gobject-introspection-1.0${_gir_version_cmp}) + if(_pc_gir_FOUND) + set(GObjectIntrospection_FOUND TRUE) + _gir_get_pkgconfig_var(GObjectIntrospection_SCANNER "g_ir_scanner") + _gir_get_pkgconfig_var(GObjectIntrospection_COMPILER "g_ir_compiler") + _gir_get_pkgconfig_var(GObjectIntrospection_GENERATE "g_ir_generate") + _gir_get_pkgconfig_var(GObjectIntrospection_GIRDIR "girdir") + _gir_get_pkgconfig_var(GObjectIntrospection_TYPELIBDIR "typelibdir") + set(GObjectIntrospection_CFLAGS "${_pc_gir_CFLAGS}") + set(GObjectIntrospection_LIBS "${_pc_gir_LIBS}") + endif() endif() endif() diff --git a/cmake/modules/FindLibXML.cmake b/cmake/modules/FindLibXML.cmake index 00120ec3..e99bf652 100644 --- a/cmake/modules/FindLibXML.cmake +++ b/cmake/modules/FindLibXML.cmake @@ -2,20 +2,21 @@ # # Once done this will define # -# LIBXML_FOUND - system has libxml +# LIBXML_FOUND - system has libxml 2.0 # LIBXML_CFLAGS # LIBXML_LIBRARIES find_package(PkgConfig) if(PKG_CONFIG_FOUND) - if(PACKAGE_FIND_VERSION_COUNT GREATER 0) - set(_libxml_version_cmp ">=${PACKAGE_FIND_VERSION}") - endif() - pkg_check_modules(_pc_libxml libxml-2.0${_libxml_version_cmp}) - if(_pc_libxml_FOUND) - set(LIBXML_FOUND TRUE) - set(LIBXML_CFLAGS "${_pc_libxml_CFLAGS}") - set(LIBXML_LIBRARIES "${_pc_libxml_LIBRARIES}") + if(DEFINED LibXML_FIND_VERSION) + set(_libxml_version_cmp ${LibXML_FIND_VERSION}) + set(_libxml_version_cmp ">=${_libxml_version_cmp}") + pkg_check_modules(_pc_libxml libxml-2.0${_libxml_version_cmp}) + if(_pc_libxml_FOUND) + set(LIBXML_FOUND TRUE) + set(LIBXML_CFLAGS "${_pc_libxml_CFLAGS}") + set(LIBXML_LIBRARIES "${_pc_libxml_LIBRARIES}") + endif() endif() endif() |