From 8d7b070410714a8c87c9ec51358fbd0e446b6681 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Fri, 2 Aug 2013 17:36:21 +0200 Subject: FindGTK2: Export GTK2_XXX_FOUND to parent scope in _GTK2_FIND_LIBRARY Also add a debug message to report if the library was found or not --- Modules/FindGTK2.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 316a2da..669d5d2 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -365,6 +365,7 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) select_library_configurations(${_var}) set(${_var}_LIBRARY ${${_var}_LIBRARY} PARENT_SCOPE) + set(${_var}_FOUND ${${_var}_FOUND} PARENT_SCOPE) set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${${_var}_LIBRARY}) set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE) @@ -376,6 +377,8 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) "${_var}_LIBRARY_DEBUG = \"${${_var}_LIBRARY_DEBUG}\"") message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " "${_var}_LIBRARY = \"${${_var}_LIBRARY}\"") + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "${_var}_FOUND = \"${${_var}_FOUND}\"") endif() endfunction() -- cgit v0.12 From fab6c2deb0ced0d4a0623fe2dfd56c0b235a5ca1 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Fri, 2 Aug 2013 17:39:28 +0200 Subject: FindGTK2: Populate GTK2_DEFINITIONS before searching for libraries --- Modules/FindGTK2.cmake | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 669d5d2..22b4707 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -450,6 +450,20 @@ if(GTK2_FIND_VERSION) endif() # +# On MSVC, according to https://wiki.gnome.org/gtkmm/MSWindows, the /vd2 flag needs to be +# passed to the compiler in order to use gtkmm +# +if(MSVC) + foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) + if(_GTK2_component STREQUAL "gtkmm") + set(GTK2_DEFINITIONS "/vd2") + elseif(_GTK2_component STREQUAL "glademm") + set(GTK2_DEFINITIONS "/vd2") + endif() + endforeach() +endif() + +# # Find all components # @@ -566,20 +580,6 @@ if(NOT GTK2_FIND_VERSION AND GTK2_GTK_INCLUDE_DIR) endif() # -# On MSVC, according to https://wiki.gnome.org/gtkmm/MSWindows, the /vd2 flag needs to be -# passed to the compiler in order to use gtkmm -# -if(MSVC) - foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) - if(_GTK2_component STREQUAL "gtkmm") - set(GTK2_DEFINITIONS "/vd2") - elseif(_GTK2_component STREQUAL "glademm") - set(GTK2_DEFINITIONS "/vd2") - endif() - endforeach() -endif() - -# # Try to enforce components # -- cgit v0.12 From 7af8ad89af137067d512ae30dc2e16d25e136a23 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Mon, 5 Aug 2013 10:56:36 +0200 Subject: FindGTK2: Search for glib-object.h instead of gobject/gobject.h This is the topmost include file for GObject header files --- Modules/FindGTK2.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 22b4707..d3f037a 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -512,7 +512,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(GTK2_ATK atk/atk.h) _GTK2_FIND_LIBRARY (GTK2_ATK atk false true) - _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT gobject/gobject.h) + _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT glib-object.h) _GTK2_FIND_LIBRARY (GTK2_GOBJECT gobject false true) _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB glib.h) -- cgit v0.12 From 9905abd1507046e56c002274103c41d4c83381a3 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Mon, 5 Aug 2013 10:57:18 +0200 Subject: FindGTK2: Create targets for each library Methods: * _GTK2_ADJUST_LIB_VARS * _GTK2_ADD_TARGET_DEPENDS_INTERNAL * _GTK2_ADD_TARGET_DEPENDS are strongly inspired by FindQt4.cmake --- Modules/FindGTK2.cmake | 150 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 147 insertions(+), 3 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index d3f037a..e36a874 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -78,6 +78,7 @@ # * Remove GTK2_SKIP_MARK_AS_ADVANCED option, as now the variables are # marked as advanced by SelectLibraryConfigurations # * Detect gmodule, pangoft2 and pangoxft libraries +# * Create targets for each library. # Version 1.4 (10/4/2012) (CMake 2.8.10) # * 12596: Missing paths for FindGTK2 on NetBSD # * 12049: Fixed detection of GTK include files in the lib folder on @@ -384,6 +385,89 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) endfunction() #============================================================= +# _GTK2_ADJUST_LIB_VARS +# Internal function to create targets for GTK2 +# _var = target to create (GTK_ is removed) +#============================================================= +function(_GTK2_ADJUST_LIB_VARS _var) + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK2_ADJUST_LIB_VARS( ${_var} )") + endif() + + string(REGEX REPLACE "GTK2_" "" _basename "${_var}") + string(TOLOWER "${_basename}" _basename) + + if(${_var}_FOUND AND NOT TARGET GTK2::${_basename}) + add_library(GTK2::${_basename} UNKNOWN IMPORTED) + + if(${_var}_LIBRARY_RELEASE) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${${_var}_LIBRARY_RELEASE}" ) + endif() + + if(${_var}_LIBRARY_DEBUG) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${${_var}_LIBRARY_DEBUG}" ) + endif() + + if(${_var}_INCLUDE_DIR) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_var}_INCLUDE_DIR}") + endif() + + if(${_var}CONFIG_INCLUDE_DIR) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_var}CONFIG_INCLUDE_DIR}") + endif() + + set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}") + + if(GTK2_USE_IMPORTED_TARGETS) + set(${_var}_LIBRARY GTK2::${_basename} PARENT_SCOPE) + endif() + endif() +endfunction() + +function(_GTK2_ADD_TARGET_DEPENDS_INTERNAL _var _property) + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK2_ADD_TARGET_DEPENDS_INTERNAL( ${_var} ${_property} )") + endif() + + string(REGEX REPLACE "GTK2_" "" _basename "${_var}") + string(TOLOWER "${_basename}" _basename) + + if (TARGET GTK2::${_basename}) + foreach(_depend ${ARGN}) + set(_valid_depends) + if (TARGET GTK2::${_depend}) + list(APPEND _valid_depends GTK2::${_depend}) + endif() + if (_valid_depends) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY ${_property} "${_valid_depends}") + endif() + set(_valid_depends) + endforeach() + endif() +endfunction() + +function(_GTK2_ADD_TARGET_DEPENDS _var) + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK2_ADD_TARGET_DEPENDS( ${_var} )") + endif() + + string(REGEX REPLACE "GTK2_" "" _basename "${_var}") + string(TOLOWER "${_basename}" _basename) + + get_target_property(_configs GTK2::${_basename} IMPORTED_CONFIGURATIONS) + _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} INTERFACE_LINK_LIBRARIES ${ARGN}) + foreach(_config ${_configs}) + _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN}) + endforeach() +endfunction() + + +#============================================================= # # main() @@ -474,94 +558,154 @@ list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES}) foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(_GTK2_component STREQUAL "gtk") _GTK2_FIND_INCLUDE_DIR(GTK2_GTK gtk/gtk.h) - if(UNIX) _GTK2_FIND_LIBRARY (GTK2_GTK gtk-x11 false true) - _GTK2_FIND_LIBRARY (GTK2_GDK gdk-x11 false true) else() _GTK2_FIND_LIBRARY (GTK2_GTK gtk-win32 false true) - _GTK2_FIND_LIBRARY (GTK2_GDK gdk-win32 false true) endif() + _GTK2_ADJUST_LIB_VARS (GTK2_GTK) _GTK2_FIND_INCLUDE_DIR(GTK2_GDK gdk/gdk.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG gdkconfig.h) + if(UNIX) + _GTK2_FIND_LIBRARY (GTK2_GDK gdk-x11 false true) + else() + _GTK2_FIND_LIBRARY (GTK2_GDK gdk-win32 false true) + endif() + _GTK2_ADJUST_LIB_VARS (GTK2_GDK) _GTK2_FIND_INCLUDE_DIR(GTK2_CAIRO cairo.h) _GTK2_FIND_LIBRARY (GTK2_CAIRO cairo false false) + _GTK2_ADJUST_LIB_VARS (GTK2_CAIRO) _GTK2_FIND_INCLUDE_DIR(GTK2_FONTCONFIG fontconfig/fontconfig.h) _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO pango/pango.h) _GTK2_FIND_LIBRARY (GTK2_PANGO pango false true) + _GTK2_ADJUST_LIB_VARS (GTK2_PANGO) _GTK2_FIND_LIBRARY (GTK2_PANGOCAIRO pangocairo false true) + _GTK2_ADJUST_LIB_VARS (GTK2_PANGOCAIRO) _GTK2_FIND_LIBRARY (GTK2_PANGOFT2 pangoft2 false true) + _GTK2_ADJUST_LIB_VARS (GTK2_PANGOFT2) _GTK2_FIND_LIBRARY (GTK2_PANGOXFT pangoxft false true) + _GTK2_ADJUST_LIB_VARS (GTK2_PANGOXFT) _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h) _GTK2_FIND_LIBRARY (GTK2_GDK_PIXBUF gdk_pixbuf false true) + _GTK2_ADJUST_LIB_VARS (GTK2_GDK_PIXBUF) _GTK2_FIND_LIBRARY (GTK2_GTHREAD gthread false true) + _GTK2_ADJUST_LIB_VARS (GTK2_GTHREAD) _GTK2_FIND_LIBRARY (GTK2_GMODULE gmodule false true) + _GTK2_ADJUST_LIB_VARS (GTK2_MODULE) _GTK2_FIND_LIBRARY (GTK2_GIO gio false true) + _GTK2_ADJUST_LIB_VARS (GTK2_GIO) _GTK2_FIND_INCLUDE_DIR(GTK2_ATK atk/atk.h) _GTK2_FIND_LIBRARY (GTK2_ATK atk false true) + _GTK2_ADJUST_LIB_VARS (GTK2_ATK) _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT glib-object.h) _GTK2_FIND_LIBRARY (GTK2_GOBJECT gobject false true) + _GTK2_ADJUST_LIB_VARS (GTK2_GOBJECT) _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB glib.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBCONFIG glibconfig.h) _GTK2_FIND_LIBRARY (GTK2_GLIB glib false true) + _GTK2_ADJUST_LIB_VARS (GTK2_GLIB) + + #_GTK2_ADD_TARGET_DEPENDS(GTK2_GOBJECT glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_GOBJECT glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_ATK gobject glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_GIO gobject glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_GTHREAD glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_GMODULE glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_GDK_PIXBUF gobject glib) + #_GTK2_ADD_TARGET_DEPENDS(GTK2_CAIRO) + set_property(TARGET GTK2::cairo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}") + set_property(TARGET GTK2::cairo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}") + _GTK2_ADD_TARGET_DEPENDS(GTK2_PANGO gobject glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_PANGOCAIRO pango cairo gobject glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_GDK pangocairo pango cairo gdk_pixbuf gobject glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_GTK gdk atk gio pangoft2 pangocairo pango cairo gdk_pixbuf gthread gobject glib) elseif(_GTK2_component STREQUAL "gtkmm") _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMM gtkmm.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMMCONFIG gtkmmconfig.h) _GTK2_FIND_LIBRARY (GTK2_GTKMM gtkmm true true) + _GTK2_ADJUST_LIB_VARS (GTK2_GTKMM) _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMM gdkmm.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMMCONFIG gdkmmconfig.h) _GTK2_FIND_LIBRARY (GTK2_GDKMM gdkmm true true) + _GTK2_ADJUST_LIB_VARS (GTK2_GDKMM) _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMM pangomm.h) _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMMCONFIG pangommconfig.h) _GTK2_FIND_LIBRARY (GTK2_PANGOMM pangomm true true) + _GTK2_ADJUST_LIB_VARS (GTK2_PANGOMM) _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM cairomm/cairomm.h) _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMMCONFIG cairommconfig.h) _GTK2_FIND_LIBRARY (GTK2_CAIROMM cairomm true true) + _GTK2_ADJUST_LIB_VARS (GTK2_CAIROMM) _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMM giomm.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMMCONFIG giommconfig.h) _GTK2_FIND_LIBRARY (GTK2_GIOMM giomm true true) + _GTK2_ADJUST_LIB_VARS (GTK2_GIOMM) _GTK2_FIND_INCLUDE_DIR(GTK2_ATKMM atkmm.h) _GTK2_FIND_LIBRARY (GTK2_ATKMM atkmm true true) + _GTK2_ADJUST_LIB_VARS (GTK2_ATKMM) _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMM glibmm.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMMCONFIG glibmmconfig.h) _GTK2_FIND_LIBRARY (GTK2_GLIBMM glibmm true true) + _GTK2_ADJUST_LIB_VARS (GTK2_GLIBMM) _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++ sigc++/sigc++.h) _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++CONFIG sigc++config.h) _GTK2_FIND_LIBRARY (GTK2_SIGC++ sigc true true) + _GTK2_ADJUST_LIB_VARS (GTK2_SIGC++) + + #_GTK2_ADD_TARGET_DEPENDS(GTK2_SIGC++) + _GTK2_ADD_TARGET_DEPENDS(GTK2_GLIBMM gobject sigc glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_GIOMM gio glibmm gobject sigc glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_ATKMM atk glibmm gobject sigc glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_CAIROMM cairo sigc++) + _GTK2_ADD_TARGET_DEPENDS(GTK2_PANGOMM glibmm cairomm pangocairo sigc++ pango cairo gobject glib) + _GTK2_ADD_TARGET_DEPENDS(GTK2_GDKMM giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) + set_property(TARGET GTK2::gtkmm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}") + set_property(TARGET GTK2::gtkmm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}") + _GTK2_ADD_TARGET_DEPENDS(GTK2_GTKMM atkmm gdkmm giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib) + set_property(TARGET GTK2::gtkmm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}") + set_property(TARGET GTK2::gtkmm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}") elseif(_GTK2_component STREQUAL "glade") _GTK2_FIND_INCLUDE_DIR(GTK2_GLADE glade/glade.h) _GTK2_FIND_LIBRARY (GTK2_GLADE glade false true) + _GTK2_ADJUST_LIB_VARS (GTK2_GLADE) + _GTK2_ADD_TARGET_DEPENDS(GTK2_GLADE gtk gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) + set_property(TARGET GTK2::glade APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}") + set_property(TARGET GTK2::glade APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}") elseif(_GTK2_component STREQUAL "glademm") _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMM libglademm.h) _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMMCONFIG libglademmconfig.h) _GTK2_FIND_LIBRARY (GTK2_GLADEMM glademm true true) + _GTK2_ADJUST_LIB_VARS (GTK2_GLADEMM) + _GTK2_ADD_TARGET_DEPENDS(GLADEMM gtkmm glade atkmm gdkmm giomm pangomm glibmm cairomm sigc++ gtk gdk atk gio pangoft pangocairo gdk_pixbuf cairo pango gthread gobject glib) + set_property(TARGET GTK2::glademm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}") + set_property(TARGET GTK2::glademm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}") else() message(FATAL_ERROR "Unknown GTK2 component ${_component}") -- cgit v0.12 From 0bc3763c9ed0b34de78f359b723402245df77e2e Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Fri, 2 Aug 2013 18:16:48 +0200 Subject: FindGTK2: Better handling of include directories Add a method _GTK2_ADD_TARGET_INCLUDE_DIRS to handle it. --- Modules/FindGTK2.cmake | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index e36a874..057cd9a 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -466,6 +466,15 @@ function(_GTK2_ADD_TARGET_DEPENDS _var) endforeach() endfunction() +function(_GTK2_ADD_TARGET_INCLUDE_DIRS _var) + string(REGEX REPLACE "GTK2_" "" _basename "${_var}") + string(TOLOWER "${_basename}" _basename) + if(TARGET GTK2::${_basename}) + foreach(_include ${ARGN}) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}") + endforeach() + endif() +endfunction() #============================================================= @@ -626,9 +635,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_ADD_TARGET_DEPENDS(GTK2_GTHREAD glib) _GTK2_ADD_TARGET_DEPENDS(GTK2_GMODULE glib) _GTK2_ADD_TARGET_DEPENDS(GTK2_GDK_PIXBUF gobject glib) - #_GTK2_ADD_TARGET_DEPENDS(GTK2_CAIRO) - set_property(TARGET GTK2::cairo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}") - set_property(TARGET GTK2::cairo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}") + _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_CAIRO ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) _GTK2_ADD_TARGET_DEPENDS(GTK2_PANGO gobject glib) _GTK2_ADD_TARGET_DEPENDS(GTK2_PANGOCAIRO pango cairo gobject glib) _GTK2_ADD_TARGET_DEPENDS(GTK2_GDK pangocairo pango cairo gdk_pixbuf gobject glib) @@ -675,18 +682,15 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (GTK2_SIGC++ sigc true true) _GTK2_ADJUST_LIB_VARS (GTK2_SIGC++) - #_GTK2_ADD_TARGET_DEPENDS(GTK2_SIGC++) _GTK2_ADD_TARGET_DEPENDS(GTK2_GLIBMM gobject sigc glib) _GTK2_ADD_TARGET_DEPENDS(GTK2_GIOMM gio glibmm gobject sigc glib) _GTK2_ADD_TARGET_DEPENDS(GTK2_ATKMM atk glibmm gobject sigc glib) _GTK2_ADD_TARGET_DEPENDS(GTK2_CAIROMM cairo sigc++) _GTK2_ADD_TARGET_DEPENDS(GTK2_PANGOMM glibmm cairomm pangocairo sigc++ pango cairo gobject glib) _GTK2_ADD_TARGET_DEPENDS(GTK2_GDKMM giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) - set_property(TARGET GTK2::gtkmm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}") - set_property(TARGET GTK2::gtkmm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}") + _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_GDKMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) _GTK2_ADD_TARGET_DEPENDS(GTK2_GTKMM atkmm gdkmm giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib) - set_property(TARGET GTK2::gtkmm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}") - set_property(TARGET GTK2::gtkmm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}") + _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_GTKMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) elseif(_GTK2_component STREQUAL "glade") @@ -694,8 +698,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (GTK2_GLADE glade false true) _GTK2_ADJUST_LIB_VARS (GTK2_GLADE) _GTK2_ADD_TARGET_DEPENDS(GTK2_GLADE gtk gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) - set_property(TARGET GTK2::glade APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}") - set_property(TARGET GTK2::glade APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}") + _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_GLADE ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) elseif(_GTK2_component STREQUAL "glademm") @@ -703,9 +706,8 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMMCONFIG libglademmconfig.h) _GTK2_FIND_LIBRARY (GTK2_GLADEMM glademm true true) _GTK2_ADJUST_LIB_VARS (GTK2_GLADEMM) - _GTK2_ADD_TARGET_DEPENDS(GLADEMM gtkmm glade atkmm gdkmm giomm pangomm glibmm cairomm sigc++ gtk gdk atk gio pangoft pangocairo gdk_pixbuf cairo pango gthread gobject glib) - set_property(TARGET GTK2::glademm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}") - set_property(TARGET GTK2::glademm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}") + _GTK2_ADD_TARGET_DEPENDS(GTK2_GLADEMM gtkmm glade atkmm gdkmm giomm pangomm glibmm cairomm sigc++ gtk gdk atk gio pangoft pangocairo gdk_pixbuf cairo pango gthread gobject glib) + _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_GLADEMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) else() message(FATAL_ERROR "Unknown GTK2 component ${_component}") -- cgit v0.12 From 682eea3909502b2e15f722dbaeecf97e86752704 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Fri, 2 Aug 2013 18:04:36 +0200 Subject: FindGTK2: Do not require the GTK_ prefix in all the internal functions This saves from using string(REGEXP) to create targets --- Modules/FindGTK2.cmake | 294 +++++++++++++++++++++++++------------------------ 1 file changed, 148 insertions(+), 146 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 057cd9a..8ec51d7 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -215,7 +215,7 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) message(STATUS "Adding ${_gtk2_arch_dir} to search path for multiarch support") endif() endif() - find_path(${_var}_INCLUDE_DIR ${_hdr} + find_path(GTK2_${_var}_INCLUDE_DIR ${_hdr} PATHS ${_gtk2_arch_dir} /usr/local/lib64 @@ -243,8 +243,8 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr) ) mark_as_advanced(GTK2_${_var}_INCLUDE_DIR) - if(${_var}_INCLUDE_DIR) - set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${${_var}_INCLUDE_DIR} PARENT_SCOPE) + if(GTK2_${_var}_INCLUDE_DIR) + set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${GTK2_${_var}_INCLUDE_DIR} PARENT_SCOPE) endif() endfunction() @@ -334,10 +334,10 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) if(GTK2_DEBUG) message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "While searching for ${_var}_LIBRARY, our proposed library list is ${_lib_list}") + "While searching for GTK2_${_var}_LIBRARY, our proposed library list is ${_lib_list}") endif() - find_library(${_var}_LIBRARY_RELEASE + find_library(GTK2_${_var}_LIBRARY_RELEASE NAMES ${_lib_list} PATHS /opt/gnome/lib @@ -351,10 +351,10 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) if(_expand_vc AND MSVC) if(GTK2_DEBUG) message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "While searching for ${_var}_LIBRARY_DEBUG our proposed library list is ${_libd_list}") + "While searching for GTK2_${_var}_LIBRARY_DEBUG our proposed library list is ${_libd_list}") endif() - find_library(${_var}_LIBRARY_DEBUG + find_library(GTK2_${_var}_LIBRARY_DEBUG NAMES ${_libd_list} PATHS $ENV{GTKMM_BASEPATH}/lib @@ -363,23 +363,23 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) ) endif() - select_library_configurations(${_var}) + select_library_configurations(GTK2_${_var}) - set(${_var}_LIBRARY ${${_var}_LIBRARY} PARENT_SCOPE) - set(${_var}_FOUND ${${_var}_FOUND} PARENT_SCOPE) + set(GTK2_${_var}_LIBRARY ${GTK2_${_var}_LIBRARY} PARENT_SCOPE) + set(GTK2_${_var}_FOUND ${GTK2_${_var}_FOUND} PARENT_SCOPE) - set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${${_var}_LIBRARY}) + set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${GTK2_${_var}_LIBRARY}) set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE) if(GTK2_DEBUG) message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "${_var}_LIBRARY_RELEASE = \"${${_var}_LIBRARY_RELEASE}\"") + "GTK2_${_var}_LIBRARY_RELEASE = \"${GTK2_${_var}_LIBRARY_RELEASE}\"") message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "${_var}_LIBRARY_DEBUG = \"${${_var}_LIBRARY_DEBUG}\"") + "GTK2_${_var}_LIBRARY_DEBUG = \"${GTK2_${_var}_LIBRARY_DEBUG}\"") message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "${_var}_LIBRARY = \"${${_var}_LIBRARY}\"") + "GTK2_${_var}_LIBRARY = \"${GTK2_${_var}_LIBRARY}\"") message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "${_var}_FOUND = \"${${_var}_FOUND}\"") + "GTK2_${_var}_FOUND = \"${GTK2_${_var}_FOUND}\"") endif() endfunction() @@ -395,34 +395,33 @@ function(_GTK2_ADJUST_LIB_VARS _var) "_GTK2_ADJUST_LIB_VARS( ${_var} )") endif() - string(REGEX REPLACE "GTK2_" "" _basename "${_var}") - string(TOLOWER "${_basename}" _basename) + string(TOLOWER "${_var}" _basename) - if(${_var}_FOUND AND NOT TARGET GTK2::${_basename}) + if(GTK2_${_var}_FOUND AND NOT TARGET GTK2::${_basename}) add_library(GTK2::${_basename} UNKNOWN IMPORTED) - if(${_var}_LIBRARY_RELEASE) + if(GTK2_${_var}_LIBRARY_RELEASE) set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${${_var}_LIBRARY_RELEASE}" ) + set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" ) endif() - if(${_var}_LIBRARY_DEBUG) + if(GTK2_${_var}_LIBRARY_DEBUG) set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${${_var}_LIBRARY_DEBUG}" ) + set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK2_${_var}_LIBRARY_DEBUG}" ) endif() - if(${_var}_INCLUDE_DIR) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_var}_INCLUDE_DIR}") + if(GTK2_${_var}_INCLUDE_DIR) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}") endif() - if(${_var}CONFIG_INCLUDE_DIR) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_var}CONFIG_INCLUDE_DIR}") + if(GTK2_${_var}CONFIG_INCLUDE_DIR) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}") endif() set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}") if(GTK2_USE_IMPORTED_TARGETS) - set(${_var}_LIBRARY GTK2::${_basename} PARENT_SCOPE) + set(GTK2_${_var}_LIBRARY GTK2::${_basename} PARENT_SCOPE) endif() endif() endfunction() @@ -433,8 +432,7 @@ function(_GTK2_ADD_TARGET_DEPENDS_INTERNAL _var _property) "_GTK2_ADD_TARGET_DEPENDS_INTERNAL( ${_var} ${_property} )") endif() - string(REGEX REPLACE "GTK2_" "" _basename "${_var}") - string(TOLOWER "${_basename}" _basename) + string(TOLOWER "${_var}" _basename) if (TARGET GTK2::${_basename}) foreach(_depend ${ARGN}) @@ -456,8 +454,7 @@ function(_GTK2_ADD_TARGET_DEPENDS _var) "_GTK2_ADD_TARGET_DEPENDS( ${_var} )") endif() - string(REGEX REPLACE "GTK2_" "" _basename "${_var}") - string(TOLOWER "${_basename}" _basename) + string(TOLOWER "${_var}" _basename) get_target_property(_configs GTK2::${_basename} IMPORTED_CONFIGURATIONS) _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} INTERFACE_LINK_LIBRARIES ${ARGN}) @@ -467,8 +464,13 @@ function(_GTK2_ADD_TARGET_DEPENDS _var) endfunction() function(_GTK2_ADD_TARGET_INCLUDE_DIRS _var) - string(REGEX REPLACE "GTK2_" "" _basename "${_var}") - string(TOLOWER "${_basename}" _basename) + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK2_ADD_TARGET_INCLUDE_DIRS( ${_var} )") + endif() + + string(TOLOWER "${_var}" _basename) + if(TARGET GTK2::${_basename}) foreach(_include ${ARGN}) set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}") @@ -502,7 +504,7 @@ if(GTK2_FIND_VERSION) message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " "Searching for version ${GTK2_FIND_VERSION}") endif() - _GTK2_FIND_INCLUDE_DIR(GTK2_GTK gtk/gtk.h) + _GTK2_FIND_INCLUDE_DIR(GTK gtk/gtk.h) if(GTK2_GTK_INCLUDE_DIR) _GTK2_GET_VERSION(GTK2_MAJOR_VERSION GTK2_MINOR_VERSION @@ -566,148 +568,148 @@ list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES}) foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(_GTK2_component STREQUAL "gtk") - _GTK2_FIND_INCLUDE_DIR(GTK2_GTK gtk/gtk.h) + _GTK2_FIND_INCLUDE_DIR(GTK gtk/gtk.h) if(UNIX) - _GTK2_FIND_LIBRARY (GTK2_GTK gtk-x11 false true) + _GTK2_FIND_LIBRARY (GTK gtk-x11 false true) else() - _GTK2_FIND_LIBRARY (GTK2_GTK gtk-win32 false true) + _GTK2_FIND_LIBRARY (GTK gtk-win32 false true) endif() - _GTK2_ADJUST_LIB_VARS (GTK2_GTK) + _GTK2_ADJUST_LIB_VARS (GTK) - _GTK2_FIND_INCLUDE_DIR(GTK2_GDK gdk/gdk.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG gdkconfig.h) + _GTK2_FIND_INCLUDE_DIR(GDK gdk/gdk.h) + _GTK2_FIND_INCLUDE_DIR(GDKCONFIG gdkconfig.h) if(UNIX) - _GTK2_FIND_LIBRARY (GTK2_GDK gdk-x11 false true) + _GTK2_FIND_LIBRARY (GDK gdk-x11 false true) else() - _GTK2_FIND_LIBRARY (GTK2_GDK gdk-win32 false true) + _GTK2_FIND_LIBRARY (GDK gdk-win32 false true) endif() - _GTK2_ADJUST_LIB_VARS (GTK2_GDK) + _GTK2_ADJUST_LIB_VARS (GDK) - _GTK2_FIND_INCLUDE_DIR(GTK2_CAIRO cairo.h) - _GTK2_FIND_LIBRARY (GTK2_CAIRO cairo false false) - _GTK2_ADJUST_LIB_VARS (GTK2_CAIRO) + _GTK2_FIND_INCLUDE_DIR(CAIRO cairo.h) + _GTK2_FIND_LIBRARY (CAIRO cairo false false) + _GTK2_ADJUST_LIB_VARS (CAIRO) - _GTK2_FIND_INCLUDE_DIR(GTK2_FONTCONFIG fontconfig/fontconfig.h) + _GTK2_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO pango/pango.h) - _GTK2_FIND_LIBRARY (GTK2_PANGO pango false true) - _GTK2_ADJUST_LIB_VARS (GTK2_PANGO) + _GTK2_FIND_INCLUDE_DIR(PANGO pango/pango.h) + _GTK2_FIND_LIBRARY (PANGO pango false true) + _GTK2_ADJUST_LIB_VARS (PANGO) - _GTK2_FIND_LIBRARY (GTK2_PANGOCAIRO pangocairo false true) - _GTK2_ADJUST_LIB_VARS (GTK2_PANGOCAIRO) + _GTK2_FIND_LIBRARY (PANGOCAIRO pangocairo false true) + _GTK2_ADJUST_LIB_VARS (PANGOCAIRO) - _GTK2_FIND_LIBRARY (GTK2_PANGOFT2 pangoft2 false true) - _GTK2_ADJUST_LIB_VARS (GTK2_PANGOFT2) + _GTK2_FIND_LIBRARY (PANGOFT2 pangoft2 false true) + _GTK2_ADJUST_LIB_VARS (PANGOFT2) - _GTK2_FIND_LIBRARY (GTK2_PANGOXFT pangoxft false true) - _GTK2_ADJUST_LIB_VARS (GTK2_PANGOXFT) + _GTK2_FIND_LIBRARY (PANGOXFT pangoxft false true) + _GTK2_ADJUST_LIB_VARS (PANGOXFT) - _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h) - _GTK2_FIND_LIBRARY (GTK2_GDK_PIXBUF gdk_pixbuf false true) - _GTK2_ADJUST_LIB_VARS (GTK2_GDK_PIXBUF) + _GTK2_FIND_INCLUDE_DIR(GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h) + _GTK2_FIND_LIBRARY (GDK_PIXBUF gdk_pixbuf false true) + _GTK2_ADJUST_LIB_VARS (GDK_PIXBUF) - _GTK2_FIND_LIBRARY (GTK2_GTHREAD gthread false true) - _GTK2_ADJUST_LIB_VARS (GTK2_GTHREAD) + _GTK2_FIND_LIBRARY (GTHREAD gthread false true) + _GTK2_ADJUST_LIB_VARS (GTHREAD) - _GTK2_FIND_LIBRARY (GTK2_GMODULE gmodule false true) - _GTK2_ADJUST_LIB_VARS (GTK2_MODULE) + _GTK2_FIND_LIBRARY (GMODULE gmodule false true) + _GTK2_ADJUST_LIB_VARS (MODULE) - _GTK2_FIND_LIBRARY (GTK2_GIO gio false true) - _GTK2_ADJUST_LIB_VARS (GTK2_GIO) + _GTK2_FIND_LIBRARY (GIO gio false true) + _GTK2_ADJUST_LIB_VARS (GIO) - _GTK2_FIND_INCLUDE_DIR(GTK2_ATK atk/atk.h) - _GTK2_FIND_LIBRARY (GTK2_ATK atk false true) - _GTK2_ADJUST_LIB_VARS (GTK2_ATK) + _GTK2_FIND_INCLUDE_DIR(ATK atk/atk.h) + _GTK2_FIND_LIBRARY (ATK atk false true) + _GTK2_ADJUST_LIB_VARS (ATK) - _GTK2_FIND_INCLUDE_DIR(GTK2_GOBJECT glib-object.h) - _GTK2_FIND_LIBRARY (GTK2_GOBJECT gobject false true) - _GTK2_ADJUST_LIB_VARS (GTK2_GOBJECT) + _GTK2_FIND_INCLUDE_DIR(GOBJECT glib-object.h) + _GTK2_FIND_LIBRARY (GOBJECT gobject false true) + _GTK2_ADJUST_LIB_VARS (GOBJECT) - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB glib.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBCONFIG glibconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GLIB glib false true) - _GTK2_ADJUST_LIB_VARS (GTK2_GLIB) + _GTK2_FIND_INCLUDE_DIR(GLIB glib.h) + _GTK2_FIND_INCLUDE_DIR(GLIBCONFIG glibconfig.h) + _GTK2_FIND_LIBRARY (GLIB glib false true) + _GTK2_ADJUST_LIB_VARS (GLIB) - #_GTK2_ADD_TARGET_DEPENDS(GTK2_GOBJECT glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_GOBJECT glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_ATK gobject glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_GIO gobject glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_GTHREAD glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_GMODULE glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_GDK_PIXBUF gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_CAIRO ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_DEPENDS(GTK2_PANGO gobject glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_PANGOCAIRO pango cairo gobject glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_GDK pangocairo pango cairo gdk_pixbuf gobject glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_GTK gdk atk gio pangoft2 pangocairo pango cairo gdk_pixbuf gthread gobject glib) + #_GTK2_ADD_TARGET_DEPENDS(GOBJECT glib) + _GTK2_ADD_TARGET_DEPENDS(GOBJECT glib) + _GTK2_ADD_TARGET_DEPENDS(ATK gobject glib) + _GTK2_ADD_TARGET_DEPENDS(GIO gobject glib) + _GTK2_ADD_TARGET_DEPENDS(GTHREAD glib) + _GTK2_ADD_TARGET_DEPENDS(GMODULE glib) + _GTK2_ADD_TARGET_DEPENDS(GDK_PIXBUF gobject glib) + _GTK2_ADD_TARGET_INCLUDE_DIRS(CAIRO ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_ADD_TARGET_DEPENDS(PANGO gobject glib) + _GTK2_ADD_TARGET_DEPENDS(PANGOCAIRO pango cairo gobject glib) + _GTK2_ADD_TARGET_DEPENDS(GDK pangocairo pango cairo gdk_pixbuf gobject glib) + _GTK2_ADD_TARGET_DEPENDS(GTK gdk atk gio pangoft2 pangocairo pango cairo gdk_pixbuf gthread gobject glib) elseif(_GTK2_component STREQUAL "gtkmm") - _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMM gtkmm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMMCONFIG gtkmmconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GTKMM gtkmm true true) - _GTK2_ADJUST_LIB_VARS (GTK2_GTKMM) - - _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMM gdkmm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMMCONFIG gdkmmconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GDKMM gdkmm true true) - _GTK2_ADJUST_LIB_VARS (GTK2_GDKMM) - - _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMM pangomm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMMCONFIG pangommconfig.h) - _GTK2_FIND_LIBRARY (GTK2_PANGOMM pangomm true true) - _GTK2_ADJUST_LIB_VARS (GTK2_PANGOMM) - - _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM cairomm/cairomm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMMCONFIG cairommconfig.h) - _GTK2_FIND_LIBRARY (GTK2_CAIROMM cairomm true true) - _GTK2_ADJUST_LIB_VARS (GTK2_CAIROMM) - - _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMM giomm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMMCONFIG giommconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GIOMM giomm true true) - _GTK2_ADJUST_LIB_VARS (GTK2_GIOMM) - - _GTK2_FIND_INCLUDE_DIR(GTK2_ATKMM atkmm.h) - _GTK2_FIND_LIBRARY (GTK2_ATKMM atkmm true true) - _GTK2_ADJUST_LIB_VARS (GTK2_ATKMM) - - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMM glibmm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMMCONFIG glibmmconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GLIBMM glibmm true true) - _GTK2_ADJUST_LIB_VARS (GTK2_GLIBMM) - - _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++ sigc++/sigc++.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++CONFIG sigc++config.h) - _GTK2_FIND_LIBRARY (GTK2_SIGC++ sigc true true) - _GTK2_ADJUST_LIB_VARS (GTK2_SIGC++) - - _GTK2_ADD_TARGET_DEPENDS(GTK2_GLIBMM gobject sigc glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_GIOMM gio glibmm gobject sigc glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_ATKMM atk glibmm gobject sigc glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_CAIROMM cairo sigc++) - _GTK2_ADD_TARGET_DEPENDS(GTK2_PANGOMM glibmm cairomm pangocairo sigc++ pango cairo gobject glib) - _GTK2_ADD_TARGET_DEPENDS(GTK2_GDKMM giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_GDKMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_DEPENDS(GTK2_GTKMM atkmm gdkmm giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_GTKMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_FIND_INCLUDE_DIR(GTKMM gtkmm.h) + _GTK2_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h) + _GTK2_FIND_LIBRARY (GTKMM gtkmm true true) + _GTK2_ADJUST_LIB_VARS (GTKMM) + + _GTK2_FIND_INCLUDE_DIR(GDKMM gdkmm.h) + _GTK2_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h) + _GTK2_FIND_LIBRARY (GDKMM gdkmm true true) + _GTK2_ADJUST_LIB_VARS (GDKMM) + + _GTK2_FIND_INCLUDE_DIR(PANGOMM pangomm.h) + _GTK2_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h) + _GTK2_FIND_LIBRARY (PANGOMM pangomm true true) + _GTK2_ADJUST_LIB_VARS (PANGOMM) + + _GTK2_FIND_INCLUDE_DIR(CAIROMM cairomm/cairomm.h) + _GTK2_FIND_INCLUDE_DIR(CAIROMMCONFIG cairommconfig.h) + _GTK2_FIND_LIBRARY (CAIROMM cairomm true true) + _GTK2_ADJUST_LIB_VARS (CAIROMM) + + _GTK2_FIND_INCLUDE_DIR(GIOMM giomm.h) + _GTK2_FIND_INCLUDE_DIR(GIOMMCONFIG giommconfig.h) + _GTK2_FIND_LIBRARY (GIOMM giomm true true) + _GTK2_ADJUST_LIB_VARS (GIOMM) + + _GTK2_FIND_INCLUDE_DIR(ATKMM atkmm.h) + _GTK2_FIND_LIBRARY (ATKMM atkmm true true) + _GTK2_ADJUST_LIB_VARS (ATKMM) + + _GTK2_FIND_INCLUDE_DIR(GLIBMM glibmm.h) + _GTK2_FIND_INCLUDE_DIR(GLIBMMCONFIG glibmmconfig.h) + _GTK2_FIND_LIBRARY (GLIBMM glibmm true true) + _GTK2_ADJUST_LIB_VARS (GLIBMM) + + _GTK2_FIND_INCLUDE_DIR(SIGC++ sigc++/sigc++.h) + _GTK2_FIND_INCLUDE_DIR(SIGC++CONFIG sigc++config.h) + _GTK2_FIND_LIBRARY (SIGC++ sigc true true) + _GTK2_ADJUST_LIB_VARS (SIGC++) + + _GTK2_ADD_TARGET_DEPENDS(GLIBMM gobject sigc glib) + _GTK2_ADD_TARGET_DEPENDS(GIOMM gio glibmm gobject sigc glib) + _GTK2_ADD_TARGET_DEPENDS(ATKMM atk glibmm gobject sigc glib) + _GTK2_ADD_TARGET_DEPENDS(CAIROMM cairo sigc++) + _GTK2_ADD_TARGET_DEPENDS(PANGOMM glibmm cairomm pangocairo sigc++ pango cairo gobject glib) + _GTK2_ADD_TARGET_DEPENDS(GDKMM giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) + _GTK2_ADD_TARGET_INCLUDE_DIRS(GDKMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_ADD_TARGET_DEPENDS(GTKMM atkmm gdkmm giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib) + _GTK2_ADD_TARGET_INCLUDE_DIRS(GTKMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) elseif(_GTK2_component STREQUAL "glade") - _GTK2_FIND_INCLUDE_DIR(GTK2_GLADE glade/glade.h) - _GTK2_FIND_LIBRARY (GTK2_GLADE glade false true) - _GTK2_ADJUST_LIB_VARS (GTK2_GLADE) - _GTK2_ADD_TARGET_DEPENDS(GTK2_GLADE gtk gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_GLADE ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_FIND_INCLUDE_DIR(GLADE glade/glade.h) + _GTK2_FIND_LIBRARY (GLADE glade false true) + _GTK2_ADJUST_LIB_VARS (GLADE) + _GTK2_ADD_TARGET_DEPENDS(GLADE gtk gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) + _GTK2_ADD_TARGET_INCLUDE_DIRS(GLADE ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) elseif(_GTK2_component STREQUAL "glademm") - _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMM libglademm.h) - _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMMCONFIG libglademmconfig.h) - _GTK2_FIND_LIBRARY (GTK2_GLADEMM glademm true true) - _GTK2_ADJUST_LIB_VARS (GTK2_GLADEMM) - _GTK2_ADD_TARGET_DEPENDS(GTK2_GLADEMM gtkmm glade atkmm gdkmm giomm pangomm glibmm cairomm sigc++ gtk gdk atk gio pangoft pangocairo gdk_pixbuf cairo pango gthread gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_GLADEMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_FIND_INCLUDE_DIR(GLADEMM libglademm.h) + _GTK2_FIND_INCLUDE_DIR(GLADEMMCONFIG libglademmconfig.h) + _GTK2_FIND_LIBRARY (GLADEMM glademm true true) + _GTK2_ADJUST_LIB_VARS (GLADEMM) + _GTK2_ADD_TARGET_DEPENDS(GLADEMM gtkmm glade atkmm gdkmm giomm pangomm glibmm cairomm sigc++ gtk gdk atk gio pangoft pangocairo gdk_pixbuf cairo pango gthread gobject glib) + _GTK2_ADD_TARGET_INCLUDE_DIRS(GLADEMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) else() message(FATAL_ERROR "Unknown GTK2 component ${_component}") -- cgit v0.12 From 67e761fabcc3010f55eb2e508c62e2bad9c57fb3 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Fri, 2 Aug 2013 18:06:34 +0200 Subject: FindGTK2: Small cleanup --- Modules/FindGTK2.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 8ec51d7..2fe5547 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -766,7 +766,6 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) GTK2_GLIBMM_INCLUDE_DIR GTK2_GLIBMMCONFIG_INCLUDE_DIR GTK2_GLIBMM_LIBRARY - ) elseif(_GTK2_component STREQUAL "glade") FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glade library was not found." -- cgit v0.12 From 4b876de9745dc147490eb5346aa8a6ed5391a7a5 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Fri, 9 Aug 2013 10:46:10 +0200 Subject: FindGTK2: Link freetype libs to targets including freetype includes --- Modules/FindGTK2.cmake | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 2fe5547..fdd48b0 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -478,6 +478,22 @@ function(_GTK2_ADD_TARGET_INCLUDE_DIRS _var) endif() endfunction() +function(_GTK2_ADD_TARGET_LIBRARIES _var) + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK2_ADD_TARGET_LIBRARIES( ${_var} )") + endif() + + string(TOLOWER "${_var}" _basename) + + if(TARGET GTK2::${_basename}) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${ARGN}") + foreach(_library ${ARGN}) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_$ "${_library}") + endforeach() + endif() +endfunction() + #============================================================= # @@ -638,6 +654,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_ADD_TARGET_DEPENDS(GMODULE glib) _GTK2_ADD_TARGET_DEPENDS(GDK_PIXBUF gobject glib) _GTK2_ADD_TARGET_INCLUDE_DIRS(CAIRO ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_ADD_TARGET_LIBRARIES(CAIRO ${FREETYPE_LIBRARIES}) _GTK2_ADD_TARGET_DEPENDS(PANGO gobject glib) _GTK2_ADD_TARGET_DEPENDS(PANGOCAIRO pango cairo gobject glib) _GTK2_ADD_TARGET_DEPENDS(GDK pangocairo pango cairo gdk_pixbuf gobject glib) @@ -691,8 +708,10 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_ADD_TARGET_DEPENDS(PANGOMM glibmm cairomm pangocairo sigc++ pango cairo gobject glib) _GTK2_ADD_TARGET_DEPENDS(GDKMM giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) _GTK2_ADD_TARGET_INCLUDE_DIRS(GDKMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_ADD_TARGET_LIBRARIES(GDKMM ${FREETYPE_LIBRARIES}) _GTK2_ADD_TARGET_DEPENDS(GTKMM atkmm gdkmm giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib) _GTK2_ADD_TARGET_INCLUDE_DIRS(GTKMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_ADD_TARGET_LIBRARIES(GTKMM ${FREETYPE_LIBRARIES}) elseif(_GTK2_component STREQUAL "glade") @@ -701,6 +720,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_ADJUST_LIB_VARS (GLADE) _GTK2_ADD_TARGET_DEPENDS(GLADE gtk gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) _GTK2_ADD_TARGET_INCLUDE_DIRS(GLADE ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_ADD_TARGET_LIBRARIES(GLADE ${FREETYPE_LIBRARIES}) elseif(_GTK2_component STREQUAL "glademm") @@ -710,6 +730,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_ADJUST_LIB_VARS (GLADEMM) _GTK2_ADD_TARGET_DEPENDS(GLADEMM gtkmm glade atkmm gdkmm giomm pangomm glibmm cairomm sigc++ gtk gdk atk gio pangoft pangocairo gdk_pixbuf cairo pango gthread gobject glib) _GTK2_ADD_TARGET_INCLUDE_DIRS(GLADEMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_ADD_TARGET_LIBRARIES(GLADEMM ${FREETYPE_LIBRARIES}) else() message(FATAL_ERROR "Unknown GTK2 component ${_component}") -- cgit v0.12 From 61242ccc8f08594c51cfe1a7b699feedb0d666ad Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Fri, 9 Aug 2013 12:22:24 +0200 Subject: FindGTK2: Fix gmodule, glibmm, pangoft2, and pangoxft targets --- Modules/FindGTK2.cmake | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index fdd48b0..e20593e 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -628,7 +628,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_ADJUST_LIB_VARS (GTHREAD) _GTK2_FIND_LIBRARY (GMODULE gmodule false true) - _GTK2_ADJUST_LIB_VARS (MODULE) + _GTK2_ADJUST_LIB_VARS (GMODULE) _GTK2_FIND_LIBRARY (GIO gio false true) _GTK2_ADJUST_LIB_VARS (GIO) @@ -646,7 +646,6 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (GLIB glib false true) _GTK2_ADJUST_LIB_VARS (GLIB) - #_GTK2_ADD_TARGET_DEPENDS(GOBJECT glib) _GTK2_ADD_TARGET_DEPENDS(GOBJECT glib) _GTK2_ADD_TARGET_DEPENDS(ATK gobject glib) _GTK2_ADD_TARGET_DEPENDS(GIO gobject glib) @@ -657,6 +656,12 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_ADD_TARGET_LIBRARIES(CAIRO ${FREETYPE_LIBRARIES}) _GTK2_ADD_TARGET_DEPENDS(PANGO gobject glib) _GTK2_ADD_TARGET_DEPENDS(PANGOCAIRO pango cairo gobject glib) + _GTK2_ADD_TARGET_DEPENDS(PANGOFT2 pango gobject glib) + _GTK2_ADD_TARGET_INCLUDE_DIRS(PANGOFT2 ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_ADD_TARGET_LIBRARIES(PANGOFT2 ${FREETYPE_LIBRARIES}) + _GTK2_ADD_TARGET_DEPENDS(PANGOXFT pangoft2 pango gobject glib) + _GTK2_ADD_TARGET_INCLUDE_DIRS(PANGOXFT ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_ADD_TARGET_LIBRARIES(PANGOXFT ${FREETYPE_LIBRARIES}) _GTK2_ADD_TARGET_DEPENDS(GDK pangocairo pango cairo gdk_pixbuf gobject glib) _GTK2_ADD_TARGET_DEPENDS(GTK gdk atk gio pangoft2 pangocairo pango cairo gdk_pixbuf gthread gobject glib) @@ -701,7 +706,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (SIGC++ sigc true true) _GTK2_ADJUST_LIB_VARS (SIGC++) - _GTK2_ADD_TARGET_DEPENDS(GLIBMM gobject sigc glib) + _GTK2_ADD_TARGET_DEPENDS(GLIBMM gobject sigc++ glib) _GTK2_ADD_TARGET_DEPENDS(GIOMM gio glibmm gobject sigc glib) _GTK2_ADD_TARGET_DEPENDS(ATKMM atk glibmm gobject sigc glib) _GTK2_ADD_TARGET_DEPENDS(CAIROMM cairo sigc++) -- cgit v0.12 From 4b47586a08741c530386f08be77b5da870bc130a Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Fri, 9 Aug 2013 10:39:46 +0200 Subject: FindGTK2: Add check to ensure that target exists --- Modules/FindGTK2.cmake | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index e20593e..3f912bb 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -456,11 +456,13 @@ function(_GTK2_ADD_TARGET_DEPENDS _var) string(TOLOWER "${_var}" _basename) - get_target_property(_configs GTK2::${_basename} IMPORTED_CONFIGURATIONS) - _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} INTERFACE_LINK_LIBRARIES ${ARGN}) - foreach(_config ${_configs}) - _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN}) - endforeach() + if(TARGET GTK2::${_basename}) + get_target_property(_configs GTK2::${_basename} IMPORTED_CONFIGURATIONS) + _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} INTERFACE_LINK_LIBRARIES ${ARGN}) + foreach(_config ${_configs}) + _GTK2_ADD_TARGET_DEPENDS_INTERNAL(${_var} IMPORTED_LINK_INTERFACE_LIBRARIES_${_config} ${ARGN}) + endforeach() + endif() endfunction() function(_GTK2_ADD_TARGET_INCLUDE_DIRS _var) -- cgit v0.12 From 56a79e1f8c947720b744282751aa2ee382f338a1 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Wed, 14 Aug 2013 10:46:42 +0200 Subject: FindGTK2: Set INTERFACE_COMPILE_DEFINITIONS target property only if not empty --- Modules/FindGTK2.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 3f912bb..fe37165 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -418,7 +418,9 @@ function(_GTK2_ADJUST_LIB_VARS _var) set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}") endif() - set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}") + if(GTK2_DEFINITIONS) + set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}") + endif() if(GTK2_USE_IMPORTED_TARGETS) set(GTK2_${_var}_LIBRARY GTK2::${_basename} PARENT_SCOPE) -- cgit v0.12 From e9f46dfeb27109fa555b75e5c308c6782cc2855d Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Wed, 14 Aug 2013 10:48:44 +0200 Subject: FindGTK2: Add config directories only if different from include ones --- Modules/FindGTK2.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index fe37165..c443ca0 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -414,7 +414,7 @@ function(_GTK2_ADJUST_LIB_VARS _var) set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}") endif() - if(GTK2_${_var}CONFIG_INCLUDE_DIR) + if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "GTK2_${_var}_INCLUDE_DIR") set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}") endif() -- cgit v0.12 From 425ec4080d6a01ef1d2b278666ea60c5627b543c Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Tue, 3 Sep 2013 15:04:32 +0200 Subject: FindGTK2: Do not link libfreetype As discussed on the mailing list, freetype includes used in GTK2 headers libraries do not require to link the library explicitly (even though it is already linked by GTK2 libraries. Also remove _GTK2_ADD_TARGET_LIBRARIES no longer used and use ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} variables instead of ${FREETYPE_INCLUDE_DIRS} --- Modules/FindGTK2.cmake | 46 ++++++++++++---------------------------------- 1 file changed, 12 insertions(+), 34 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index c443ca0..738e022 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -66,7 +66,10 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# Version 1.5 (UNRELEASED) (CMake 2.8.12) +# Version 1.6 (CMake 2.8.13) +# * Create targets for each library +# * Do not link libfreetype +# Version 1.5 (CMake 2.8.12) # * 14236: Detect gthread library # Detect pangocairo on windows # Detect pangocairo with gtk module instead of with gtkmm @@ -78,7 +81,6 @@ # * Remove GTK2_SKIP_MARK_AS_ADVANCED option, as now the variables are # marked as advanced by SelectLibraryConfigurations # * Detect gmodule, pangoft2 and pangoxft libraries -# * Create targets for each library. # Version 1.4 (10/4/2012) (CMake 2.8.10) # * 12596: Missing paths for FindGTK2 on NetBSD # * 12049: Fixed detection of GTK include files in the lib folder on @@ -482,22 +484,6 @@ function(_GTK2_ADD_TARGET_INCLUDE_DIRS _var) endif() endfunction() -function(_GTK2_ADD_TARGET_LIBRARIES _var) - if(GTK2_DEBUG) - message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "_GTK2_ADD_TARGET_LIBRARIES( ${_var} )") - endif() - - string(TOLOWER "${_var}" _basename) - - if(TARGET GTK2::${_basename}) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${ARGN}") - foreach(_library ${ARGN}) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_$ "${_library}") - endforeach() - endif() -endfunction() - #============================================================= # @@ -583,8 +569,7 @@ endif() # find_package(Freetype QUIET) -list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS}) -list(APPEND GTK2_LIBRARIES ${FREETYPE_LIBRARIES}) +list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(_GTK2_component STREQUAL "gtk") @@ -656,16 +641,13 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_ADD_TARGET_DEPENDS(GTHREAD glib) _GTK2_ADD_TARGET_DEPENDS(GMODULE glib) _GTK2_ADD_TARGET_DEPENDS(GDK_PIXBUF gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(CAIRO ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_LIBRARIES(CAIRO ${FREETYPE_LIBRARIES}) + _GTK2_ADD_TARGET_INCLUDE_DIRS(CAIRO ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) _GTK2_ADD_TARGET_DEPENDS(PANGO gobject glib) _GTK2_ADD_TARGET_DEPENDS(PANGOCAIRO pango cairo gobject glib) _GTK2_ADD_TARGET_DEPENDS(PANGOFT2 pango gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(PANGOFT2 ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_LIBRARIES(PANGOFT2 ${FREETYPE_LIBRARIES}) + _GTK2_ADD_TARGET_INCLUDE_DIRS(PANGOFT2 ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) _GTK2_ADD_TARGET_DEPENDS(PANGOXFT pangoft2 pango gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(PANGOXFT ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_LIBRARIES(PANGOXFT ${FREETYPE_LIBRARIES}) + _GTK2_ADD_TARGET_INCLUDE_DIRS(PANGOXFT ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) _GTK2_ADD_TARGET_DEPENDS(GDK pangocairo pango cairo gdk_pixbuf gobject glib) _GTK2_ADD_TARGET_DEPENDS(GTK gdk atk gio pangoft2 pangocairo pango cairo gdk_pixbuf gthread gobject glib) @@ -716,11 +698,9 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_ADD_TARGET_DEPENDS(CAIROMM cairo sigc++) _GTK2_ADD_TARGET_DEPENDS(PANGOMM glibmm cairomm pangocairo sigc++ pango cairo gobject glib) _GTK2_ADD_TARGET_DEPENDS(GDKMM giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GDKMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_LIBRARIES(GDKMM ${FREETYPE_LIBRARIES}) + _GTK2_ADD_TARGET_INCLUDE_DIRS(GDKMM ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) _GTK2_ADD_TARGET_DEPENDS(GTKMM atkmm gdkmm giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GTKMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_LIBRARIES(GTKMM ${FREETYPE_LIBRARIES}) + _GTK2_ADD_TARGET_INCLUDE_DIRS(GTKMM ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) elseif(_GTK2_component STREQUAL "glade") @@ -728,8 +708,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (GLADE glade false true) _GTK2_ADJUST_LIB_VARS (GLADE) _GTK2_ADD_TARGET_DEPENDS(GLADE gtk gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GLADE ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_LIBRARIES(GLADE ${FREETYPE_LIBRARIES}) + _GTK2_ADD_TARGET_INCLUDE_DIRS(GLADE ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) elseif(_GTK2_component STREQUAL "glademm") @@ -738,8 +717,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (GLADEMM glademm true true) _GTK2_ADJUST_LIB_VARS (GLADEMM) _GTK2_ADD_TARGET_DEPENDS(GLADEMM gtkmm glade atkmm gdkmm giomm pangomm glibmm cairomm sigc++ gtk gdk atk gio pangoft pangocairo gdk_pixbuf cairo pango gthread gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GLADEMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_LIBRARIES(GLADEMM ${FREETYPE_LIBRARIES}) + _GTK2_ADD_TARGET_INCLUDE_DIRS(GLADEMM ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) else() message(FATAL_ERROR "Unknown GTK2 component ${_component}") -- cgit v0.12 From b69720d9ad08290d85eb2a71f9e7d194ad1755c8 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Tue, 17 Sep 2013 15:04:45 +0200 Subject: FindGTK2: Add libraries to the GTK2_LIBRARIES variable only when found Some libraries (e.g. gio) are not necessary, and often not available with older GTK2 versions, therefore GTK_LIBRARIES should not contain GTK2_XXX-NOT_FOUND for these libraries. --- Modules/FindGTK2.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 738e022..2020c06 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -370,8 +370,10 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) set(GTK2_${_var}_LIBRARY ${GTK2_${_var}_LIBRARY} PARENT_SCOPE) set(GTK2_${_var}_FOUND ${GTK2_${_var}_FOUND} PARENT_SCOPE) - set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${GTK2_${_var}_LIBRARY}) - set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE) + if(GTK2_${_var}_FOUND) + set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${GTK2_${_var}_LIBRARY}) + set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE) + endif() if(GTK2_DEBUG) message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " -- cgit v0.12 From fffbd7252d45fd1e7085eb408d84498ed457893c Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Tue, 17 Sep 2013 16:49:26 +0200 Subject: FindGTK2: Do not add freetype includes if they are not found On some older system they are not required --- Modules/FindGTK2.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 2020c06..37a70e4 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -481,7 +481,9 @@ function(_GTK2_ADD_TARGET_INCLUDE_DIRS _var) if(TARGET GTK2::${_basename}) foreach(_include ${ARGN}) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}") + if(${_include}) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}") + endif() endforeach() endif() endfunction() @@ -571,7 +573,9 @@ endif() # find_package(Freetype QUIET) -list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) +if(${FREETYPE_INCLUDE_DIR_ft2build} AND ${FREETYPE_INCLUDE_DIR_freetype2}) + list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) +endif() foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(_GTK2_component STREQUAL "gtk") -- cgit v0.12 From d5f130cdf68eaa5f91fb51f2a92d5790dee11804 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Mon, 23 Sep 2013 15:31:56 +0200 Subject: FindGTK2: Refactor _GTK2_ADJUST_LIB_VARS into _GTK2_ADD_TARGET This function avoids creating the targets when the required dependencies were not found. Also fix some wrong dependency and some typo. ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} are now required for gtkmm component --- Modules/FindGTK2.cmake | 313 +++++++++++++++++++++++++------------------------ 1 file changed, 161 insertions(+), 152 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 37a70e4..7027811 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -133,6 +133,7 @@ #============================================================= include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr) file(STRINGS ${_gtkversion_hdr} _contents REGEX "#define GTK_M[A-Z]+_VERSION[ \t]+") @@ -388,49 +389,6 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) endfunction() -#============================================================= -# _GTK2_ADJUST_LIB_VARS -# Internal function to create targets for GTK2 -# _var = target to create (GTK_ is removed) -#============================================================= -function(_GTK2_ADJUST_LIB_VARS _var) - if(GTK2_DEBUG) - message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " - "_GTK2_ADJUST_LIB_VARS( ${_var} )") - endif() - - string(TOLOWER "${_var}" _basename) - - if(GTK2_${_var}_FOUND AND NOT TARGET GTK2::${_basename}) - add_library(GTK2::${_basename} UNKNOWN IMPORTED) - - if(GTK2_${_var}_LIBRARY_RELEASE) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" ) - endif() - - if(GTK2_${_var}_LIBRARY_DEBUG) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK2_${_var}_LIBRARY_DEBUG}" ) - endif() - - if(GTK2_${_var}_INCLUDE_DIR) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}") - endif() - - if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "GTK2_${_var}_INCLUDE_DIR") - set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}") - endif() - - if(GTK2_DEFINITIONS) - set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}") - endif() - - if(GTK2_USE_IMPORTED_TARGETS) - set(GTK2_${_var}_LIBRARY GTK2::${_basename} PARENT_SCOPE) - endif() - endif() -endfunction() function(_GTK2_ADD_TARGET_DEPENDS_INTERNAL _var _property) if(GTK2_DEBUG) @@ -481,14 +439,82 @@ function(_GTK2_ADD_TARGET_INCLUDE_DIRS _var) if(TARGET GTK2::${_basename}) foreach(_include ${ARGN}) - if(${_include}) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}") - endif() + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}") endforeach() endif() endfunction() #============================================================= +# _GTK2_ADD_TARGET +# Internal function to create targets for GTK2 +# _var = target to create +#============================================================= +function(_GTK2_ADD_TARGET _var) + if(GTK2_DEBUG) + message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] " + "_GTK2_ADD_TARGET( ${_var} )") + endif() + + string(TOLOWER "${_var}" _basename) + + cmake_parse_arguments(_${_var} "" "" "GTK2_DEPENDS;EXTRA_INCLUDES" ${ARGN}) + + # Do not create the target if dependencies are missing + foreach(_dep ${_${_var}_GTK2_DEPENDS}) + if(NOT TARGET GTK2::${_dep}) + return() + endif() + endforeach() + + foreach(_include ${_${_var}_EXTRA_INCLUDES}) + if(NOT _include) + return() + endif() + endforeach() + + if(GTK2_${_var}_FOUND AND NOT TARGET GTK2::${_basename}) + add_library(GTK2::${_basename} UNKNOWN IMPORTED) + + if(GTK2_${_var}_LIBRARY_RELEASE) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" ) + endif() + + if(GTK2_${_var}_LIBRARY_DEBUG) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK2_${_var}_LIBRARY_DEBUG}" ) + endif() + + if(GTK2_${_var}_INCLUDE_DIR) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}") + endif() + + if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "GTK2_${_var}_INCLUDE_DIR") + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}") + endif() + + if(GTK2_DEFINITIONS) + set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}") + endif() + + if(_${_var}_GTK2_DEPENDS) + _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS}) + endif() + + if(_${_var}_EXTRA_INCLUDES) + _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_${_var}_EXTRA_INCLUDES}) + endif() + + if(GTK2_USE_IMPORTED_TARGETS) + set(GTK2_${_var}_LIBRARY GTK2::${_basename} PARENT_SCOPE) + endif() + + endif() +endfunction() + + + +#============================================================= # # main() @@ -573,157 +599,137 @@ endif() # find_package(Freetype QUIET) -if(${FREETYPE_INCLUDE_DIR_ft2build} AND ${FREETYPE_INCLUDE_DIR_freetype2}) +if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) list(APPEND GTK2_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) endif() foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(_GTK2_component STREQUAL "gtk") - _GTK2_FIND_INCLUDE_DIR(GTK gtk/gtk.h) - if(UNIX) - _GTK2_FIND_LIBRARY (GTK gtk-x11 false true) - else() - _GTK2_FIND_LIBRARY (GTK gtk-win32 false true) - endif() - _GTK2_ADJUST_LIB_VARS (GTK) + _GTK2_FIND_INCLUDE_DIR(GLIB glib.h) + _GTK2_FIND_INCLUDE_DIR(GLIBCONFIG glibconfig.h) + _GTK2_FIND_LIBRARY (GLIB glib false true) + _GTK2_ADD_TARGET (GLIB) - _GTK2_FIND_INCLUDE_DIR(GDK gdk/gdk.h) - _GTK2_FIND_INCLUDE_DIR(GDKCONFIG gdkconfig.h) - if(UNIX) - _GTK2_FIND_LIBRARY (GDK gdk-x11 false true) - else() - _GTK2_FIND_LIBRARY (GDK gdk-win32 false true) - endif() - _GTK2_ADJUST_LIB_VARS (GDK) + _GTK2_FIND_INCLUDE_DIR(GOBJECT glib-object.h) + _GTK2_FIND_LIBRARY (GOBJECT gobject false true) + _GTK2_ADD_TARGET (GOBJECT GTK2_DEPENDS glib) + + _GTK2_FIND_INCLUDE_DIR(ATK atk/atk.h) + _GTK2_FIND_LIBRARY (ATK atk false true) + _GTK2_ADD_TARGET (ATK GTK2_DEPENDS gobject glib) + + _GTK2_FIND_LIBRARY (GIO gio false true) + _GTK2_ADD_TARGET (GIO GTK2_DEPENDS gobject glib) + + _GTK2_FIND_LIBRARY (GTHREAD gthread false true) + _GTK2_ADD_TARGET (GTHREAD GTK2_DEPENDS glib) + + _GTK2_FIND_LIBRARY (GMODULE gmodule false true) + _GTK2_ADD_TARGET (GMODULE GTK2_DEPENDS glib) + + _GTK2_FIND_INCLUDE_DIR(GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h) + _GTK2_FIND_LIBRARY (GDK_PIXBUF gdk_pixbuf false true) + _GTK2_ADD_TARGET (GDK_PIXBUF GTK2_DEPENDS gobject glib) _GTK2_FIND_INCLUDE_DIR(CAIRO cairo.h) _GTK2_FIND_LIBRARY (CAIRO cairo false false) - _GTK2_ADJUST_LIB_VARS (CAIRO) - - _GTK2_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h) + _GTK2_ADD_TARGET (CAIRO) _GTK2_FIND_INCLUDE_DIR(PANGO pango/pango.h) _GTK2_FIND_LIBRARY (PANGO pango false true) - _GTK2_ADJUST_LIB_VARS (PANGO) + _GTK2_ADD_TARGET (PANGO GTK2_DEPENDS gobject glib) _GTK2_FIND_LIBRARY (PANGOCAIRO pangocairo false true) - _GTK2_ADJUST_LIB_VARS (PANGOCAIRO) + _GTK2_ADD_TARGET (PANGOCAIRO GTK2_DEPENDS pango cairo gobject glib) _GTK2_FIND_LIBRARY (PANGOFT2 pangoft2 false true) - _GTK2_ADJUST_LIB_VARS (PANGOFT2) + _GTK2_ADD_TARGET (PANGOFT2 GTK2_DEPENDS pango gobject glib + EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) _GTK2_FIND_LIBRARY (PANGOXFT pangoxft false true) - _GTK2_ADJUST_LIB_VARS (PANGOXFT) - - _GTK2_FIND_INCLUDE_DIR(GDK_PIXBUF gdk-pixbuf/gdk-pixbuf.h) - _GTK2_FIND_LIBRARY (GDK_PIXBUF gdk_pixbuf false true) - _GTK2_ADJUST_LIB_VARS (GDK_PIXBUF) - - _GTK2_FIND_LIBRARY (GTHREAD gthread false true) - _GTK2_ADJUST_LIB_VARS (GTHREAD) + _GTK2_ADD_TARGET (PANGOXFT GTK2_DEPENDS pangoft2 pango gobject glib + EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) - _GTK2_FIND_LIBRARY (GMODULE gmodule false true) - _GTK2_ADJUST_LIB_VARS (GMODULE) - - _GTK2_FIND_LIBRARY (GIO gio false true) - _GTK2_ADJUST_LIB_VARS (GIO) - - _GTK2_FIND_INCLUDE_DIR(ATK atk/atk.h) - _GTK2_FIND_LIBRARY (ATK atk false true) - _GTK2_ADJUST_LIB_VARS (ATK) + _GTK2_FIND_INCLUDE_DIR(GDK gdk/gdk.h) + _GTK2_FIND_INCLUDE_DIR(GDKCONFIG gdkconfig.h) + if(UNIX) + _GTK2_FIND_LIBRARY (GDK gdk-x11 false true) + else() + _GTK2_FIND_LIBRARY (GDK gdk-win32 false true) + endif() + _GTK2_ADD_TARGET (GDK GTK2_DEPENDS pangocairo pango cairo gdk_pixbuf gobject glib) - _GTK2_FIND_INCLUDE_DIR(GOBJECT glib-object.h) - _GTK2_FIND_LIBRARY (GOBJECT gobject false true) - _GTK2_ADJUST_LIB_VARS (GOBJECT) + _GTK2_FIND_INCLUDE_DIR(GTK gtk/gtk.h) + if(UNIX) + _GTK2_FIND_LIBRARY (GTK gtk-x11 false true) + else() + _GTK2_FIND_LIBRARY (GTK gtk-win32 false true) + endif() + _GTK2_ADD_TARGET (GTK GTK2_DEPENDS gdk atk gio pangoft2 pangocairo pango cairo gdk_pixbuf gthread gobject glib) - _GTK2_FIND_INCLUDE_DIR(GLIB glib.h) - _GTK2_FIND_INCLUDE_DIR(GLIBCONFIG glibconfig.h) - _GTK2_FIND_LIBRARY (GLIB glib false true) - _GTK2_ADJUST_LIB_VARS (GLIB) - - _GTK2_ADD_TARGET_DEPENDS(GOBJECT glib) - _GTK2_ADD_TARGET_DEPENDS(ATK gobject glib) - _GTK2_ADD_TARGET_DEPENDS(GIO gobject glib) - _GTK2_ADD_TARGET_DEPENDS(GTHREAD glib) - _GTK2_ADD_TARGET_DEPENDS(GMODULE glib) - _GTK2_ADD_TARGET_DEPENDS(GDK_PIXBUF gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(CAIRO ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_DEPENDS(PANGO gobject glib) - _GTK2_ADD_TARGET_DEPENDS(PANGOCAIRO pango cairo gobject glib) - _GTK2_ADD_TARGET_DEPENDS(PANGOFT2 pango gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(PANGOFT2 ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_DEPENDS(PANGOXFT pangoft2 pango gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(PANGOXFT ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_DEPENDS(GDK pangocairo pango cairo gdk_pixbuf gobject glib) - _GTK2_ADD_TARGET_DEPENDS(GTK gdk atk gio pangoft2 pangocairo pango cairo gdk_pixbuf gthread gobject glib) + # Left for compatibility with previous versions. It doesn't seem to be required + _GTK2_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h) elseif(_GTK2_component STREQUAL "gtkmm") - _GTK2_FIND_INCLUDE_DIR(GTKMM gtkmm.h) - _GTK2_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h) - _GTK2_FIND_LIBRARY (GTKMM gtkmm true true) - _GTK2_ADJUST_LIB_VARS (GTKMM) - - _GTK2_FIND_INCLUDE_DIR(GDKMM gdkmm.h) - _GTK2_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h) - _GTK2_FIND_LIBRARY (GDKMM gdkmm true true) - _GTK2_ADJUST_LIB_VARS (GDKMM) - - _GTK2_FIND_INCLUDE_DIR(PANGOMM pangomm.h) - _GTK2_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h) - _GTK2_FIND_LIBRARY (PANGOMM pangomm true true) - _GTK2_ADJUST_LIB_VARS (PANGOMM) + _GTK2_FIND_INCLUDE_DIR(SIGC++ sigc++/sigc++.h) + _GTK2_FIND_INCLUDE_DIR(SIGC++CONFIG sigc++config.h) + _GTK2_FIND_LIBRARY (SIGC++ sigc true true) + _GTK2_ADD_TARGET (SIGC++) - _GTK2_FIND_INCLUDE_DIR(CAIROMM cairomm/cairomm.h) - _GTK2_FIND_INCLUDE_DIR(CAIROMMCONFIG cairommconfig.h) - _GTK2_FIND_LIBRARY (CAIROMM cairomm true true) - _GTK2_ADJUST_LIB_VARS (CAIROMM) + _GTK2_FIND_INCLUDE_DIR(GLIBMM glibmm.h) + _GTK2_FIND_INCLUDE_DIR(GLIBMMCONFIG glibmmconfig.h) + _GTK2_FIND_LIBRARY (GLIBMM glibmm true true) + _GTK2_ADD_TARGET (GLIBMM GTK2_DEPENDS gobject sigc++ glib) _GTK2_FIND_INCLUDE_DIR(GIOMM giomm.h) _GTK2_FIND_INCLUDE_DIR(GIOMMCONFIG giommconfig.h) _GTK2_FIND_LIBRARY (GIOMM giomm true true) - _GTK2_ADJUST_LIB_VARS (GIOMM) + _GTK2_ADD_TARGET (GIOMM GTK2_DEPENDS gio glibmm gobject sigc++ glib) _GTK2_FIND_INCLUDE_DIR(ATKMM atkmm.h) _GTK2_FIND_LIBRARY (ATKMM atkmm true true) - _GTK2_ADJUST_LIB_VARS (ATKMM) + _GTK2_ADD_TARGET (ATKMM GTK2_DEPENDS atk glibmm gobject sigc++ glib) - _GTK2_FIND_INCLUDE_DIR(GLIBMM glibmm.h) - _GTK2_FIND_INCLUDE_DIR(GLIBMMCONFIG glibmmconfig.h) - _GTK2_FIND_LIBRARY (GLIBMM glibmm true true) - _GTK2_ADJUST_LIB_VARS (GLIBMM) + _GTK2_FIND_INCLUDE_DIR(CAIROMM cairomm/cairomm.h) + _GTK2_FIND_INCLUDE_DIR(CAIROMMCONFIG cairommconfig.h) + _GTK2_FIND_LIBRARY (CAIROMM cairomm true true) + _GTK2_ADD_TARGET (CAIROMM GTK2_DEPENDS cairo sigc++ + EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) - _GTK2_FIND_INCLUDE_DIR(SIGC++ sigc++/sigc++.h) - _GTK2_FIND_INCLUDE_DIR(SIGC++CONFIG sigc++config.h) - _GTK2_FIND_LIBRARY (SIGC++ sigc true true) - _GTK2_ADJUST_LIB_VARS (SIGC++) - - _GTK2_ADD_TARGET_DEPENDS(GLIBMM gobject sigc++ glib) - _GTK2_ADD_TARGET_DEPENDS(GIOMM gio glibmm gobject sigc glib) - _GTK2_ADD_TARGET_DEPENDS(ATKMM atk glibmm gobject sigc glib) - _GTK2_ADD_TARGET_DEPENDS(CAIROMM cairo sigc++) - _GTK2_ADD_TARGET_DEPENDS(PANGOMM glibmm cairomm pangocairo sigc++ pango cairo gobject glib) - _GTK2_ADD_TARGET_DEPENDS(GDKMM giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GDKMM ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) - _GTK2_ADD_TARGET_DEPENDS(GTKMM atkmm gdkmm giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GTKMM ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_FIND_INCLUDE_DIR(PANGOMM pangomm.h) + _GTK2_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h) + _GTK2_FIND_LIBRARY (PANGOMM pangomm true true) + _GTK2_ADD_TARGET (PANGOMM GTK2_DEPENDS glibmm cairomm pangocairo sigc++ pango cairo gobject glib + EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + + + _GTK2_FIND_INCLUDE_DIR(GDKMM gdkmm.h) + _GTK2_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h) + _GTK2_FIND_LIBRARY (GDKMM gdkmm true true) + _GTK2_ADD_TARGET (GDKMM GTK2_DEPENDS giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib + EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + + _GTK2_FIND_INCLUDE_DIR(GTKMM gtkmm.h) + _GTK2_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h) + _GTK2_FIND_LIBRARY (GTKMM gtkmm true true) + _GTK2_ADD_TARGET (GTKMM GTK2_DEPENDS atkmm gdkmm giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib + EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) elseif(_GTK2_component STREQUAL "glade") _GTK2_FIND_INCLUDE_DIR(GLADE glade/glade.h) _GTK2_FIND_LIBRARY (GLADE glade false true) - _GTK2_ADJUST_LIB_VARS (GLADE) - _GTK2_ADD_TARGET_DEPENDS(GLADE gtk gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GLADE ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_ADD_TARGET (GLADE GTK2_DEPENDS gtk gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib + EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) elseif(_GTK2_component STREQUAL "glademm") _GTK2_FIND_INCLUDE_DIR(GLADEMM libglademm.h) _GTK2_FIND_INCLUDE_DIR(GLADEMMCONFIG libglademmconfig.h) _GTK2_FIND_LIBRARY (GLADEMM glademm true true) - _GTK2_ADJUST_LIB_VARS (GLADEMM) - _GTK2_ADD_TARGET_DEPENDS(GLADEMM gtkmm glade atkmm gdkmm giomm pangomm glibmm cairomm sigc++ gtk gdk atk gio pangoft pangocairo gdk_pixbuf cairo pango gthread gobject glib) - _GTK2_ADD_TARGET_INCLUDE_DIRS(GLADEMM ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2} ${GTK2_FONTCONFIG_INCLUDE_DIRS}) + _GTK2_ADD_TARGET (GLADEMM GTK2_DEPENDS gtkmm glade atkmm gdkmm giomm pangomm glibmm cairomm sigc++ gtk gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib + EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) else() message(FATAL_ERROR "Unknown GTK2 component ${_component}") @@ -780,6 +786,9 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) GTK2_GLIBMM_INCLUDE_DIR GTK2_GLIBMMCONFIG_INCLUDE_DIR GTK2_GLIBMM_LIBRARY + + FREETYPE_INCLUDE_DIR_ft2build + FREETYPE_INCLUDE_DIR_freetype2 ) elseif(_GTK2_component STREQUAL "glade") FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glade library was not found." -- cgit v0.12 From 24e0272b23bc3b699be05baae676608977cb4533 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Wed, 25 Sep 2013 15:06:14 +0200 Subject: FindGTK2: do not skip target creation if optional dependencies are not found On some older GTK2 version gio, giomm and cairomm are not available --- Modules/FindGTK2.cmake | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 7027811..4459c78 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -457,7 +457,7 @@ function(_GTK2_ADD_TARGET _var) string(TOLOWER "${_var}" _basename) - cmake_parse_arguments(_${_var} "" "" "GTK2_DEPENDS;EXTRA_INCLUDES" ${ARGN}) + cmake_parse_arguments(_${_var} "" "" "GTK2_DEPENDS;GTK2_OPTIONAL_DEPENDS;EXTRA_INCLUDES" ${ARGN}) # Do not create the target if dependencies are missing foreach(_dep ${_${_var}_GTK2_DEPENDS}) @@ -498,7 +498,7 @@ function(_GTK2_ADD_TARGET _var) endif() if(_${_var}_GTK2_DEPENDS) - _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS}) + _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS} ${_${_var}_GTK2_OPTIONAL_DEPENDS}) endif() if(_${_var}_EXTRA_INCLUDES) @@ -665,7 +665,8 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) else() _GTK2_FIND_LIBRARY (GTK gtk-win32 false true) endif() - _GTK2_ADD_TARGET (GTK GTK2_DEPENDS gdk atk gio pangoft2 pangocairo pango cairo gdk_pixbuf gthread gobject glib) + _GTK2_ADD_TARGET (GTK GTK2_DEPENDS gdk atk pangoft2 pangocairo pango cairo gdk_pixbuf gthread gobject glib + GTK2_OPTIONAL_DEPENDS gio) # Left for compatibility with previous versions. It doesn't seem to be required _GTK2_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h) @@ -700,20 +701,23 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(PANGOMM pangomm.h) _GTK2_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h) _GTK2_FIND_LIBRARY (PANGOMM pangomm true true) - _GTK2_ADD_TARGET (PANGOMM GTK2_DEPENDS glibmm cairomm pangocairo sigc++ pango cairo gobject glib + _GTK2_ADD_TARGET (PANGOMM GTK2_DEPENDS glibmm pangocairo sigc++ pango cairo gobject glib + GTK2_OPTIONAL_DEPENDS cairomm EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) _GTK2_FIND_INCLUDE_DIR(GDKMM gdkmm.h) _GTK2_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h) _GTK2_FIND_LIBRARY (GDKMM gdkmm true true) - _GTK2_ADD_TARGET (GDKMM GTK2_DEPENDS giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib + _GTK2_ADD_TARGET (GDKMM GTK2_DEPENDS pangomm gtk glibmm sigc++ gdk atk pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib + GTK2_OPTIONAL_DEPENDS giomm cairomm gio EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) _GTK2_FIND_INCLUDE_DIR(GTKMM gtkmm.h) _GTK2_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h) _GTK2_FIND_LIBRARY (GTKMM gtkmm true true) - _GTK2_ADD_TARGET (GTKMM GTK2_DEPENDS atkmm gdkmm giomm pangomm gtk glibmm cairomm sigc++ gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib + _GTK2_ADD_TARGET (GTKMM GTK2_DEPENDS atkmm gdkmm pangomm gtk glibmm sigc++ gdk atk pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib + GTK2_OPTIONAL_DEPENDS giomm cairomm gio EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) elseif(_GTK2_component STREQUAL "glade") @@ -728,7 +732,8 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(GLADEMM libglademm.h) _GTK2_FIND_INCLUDE_DIR(GLADEMMCONFIG libglademmconfig.h) _GTK2_FIND_LIBRARY (GLADEMM glademm true true) - _GTK2_ADD_TARGET (GLADEMM GTK2_DEPENDS gtkmm glade atkmm gdkmm giomm pangomm glibmm cairomm sigc++ gtk gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib + _GTK2_ADD_TARGET (GLADEMM GTK2_DEPENDS gtkmm glade atkmm gdkmm giomm pangomm glibmm sigc++ gtk gdk atk pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib + GTK2_OPTIONAL_DEPENDS giomm cairomm gio EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) else() -- cgit v0.12 From 26f790f0b63168077d0d5fc3d241a38fdd3c099f Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Mon, 30 Sep 2013 23:32:36 +0200 Subject: FindGTK2: Change extra includes -> optional On some versions they are not required. --- Modules/FindGTK2.cmake | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 4459c78..2f00c56 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -457,22 +457,16 @@ function(_GTK2_ADD_TARGET _var) string(TOLOWER "${_var}" _basename) - cmake_parse_arguments(_${_var} "" "" "GTK2_DEPENDS;GTK2_OPTIONAL_DEPENDS;EXTRA_INCLUDES" ${ARGN}) - - # Do not create the target if dependencies are missing - foreach(_dep ${_${_var}_GTK2_DEPENDS}) - if(NOT TARGET GTK2::${_dep}) - return() - endif() - endforeach() - - foreach(_include ${_${_var}_EXTRA_INCLUDES}) - if(NOT _include) - return() - endif() - endforeach() + cmake_parse_arguments(_${_var} "" "" "GTK2_DEPENDS;GTK2_OPTIONAL_DEPENDS;OPTIONAL_INCLUDES" ${ARGN}) if(GTK2_${_var}_FOUND AND NOT TARGET GTK2::${_basename}) + # Do not create the target if dependencies are missing + foreach(_dep ${_${_var}_GTK2_DEPENDS}) + if(NOT TARGET GTK2::${_dep}) + return() + endif() + endforeach() + add_library(GTK2::${_basename} UNKNOWN IMPORTED) if(GTK2_${_var}_LIBRARY_RELEASE) @@ -501,8 +495,8 @@ function(_GTK2_ADD_TARGET _var) _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS} ${_${_var}_GTK2_OPTIONAL_DEPENDS}) endif() - if(_${_var}_EXTRA_INCLUDES) - _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_${_var}_EXTRA_INCLUDES}) + if(_${_var}_OPTIONAL_INCLUDES) + _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_${_var}_OPTIONAL_INCLUDES}) endif() if(GTK2_USE_IMPORTED_TARGETS) @@ -644,11 +638,11 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (PANGOFT2 pangoft2 false true) _GTK2_ADD_TARGET (PANGOFT2 GTK2_DEPENDS pango gobject glib - EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) _GTK2_FIND_LIBRARY (PANGOXFT pangoxft false true) _GTK2_ADD_TARGET (PANGOXFT GTK2_DEPENDS pangoft2 pango gobject glib - EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) _GTK2_FIND_INCLUDE_DIR(GDK gdk/gdk.h) _GTK2_FIND_INCLUDE_DIR(GDKCONFIG gdkconfig.h) @@ -696,14 +690,14 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(CAIROMMCONFIG cairommconfig.h) _GTK2_FIND_LIBRARY (CAIROMM cairomm true true) _GTK2_ADD_TARGET (CAIROMM GTK2_DEPENDS cairo sigc++ - EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) _GTK2_FIND_INCLUDE_DIR(PANGOMM pangomm.h) _GTK2_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h) _GTK2_FIND_LIBRARY (PANGOMM pangomm true true) _GTK2_ADD_TARGET (PANGOMM GTK2_DEPENDS glibmm pangocairo sigc++ pango cairo gobject glib GTK2_OPTIONAL_DEPENDS cairomm - EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) _GTK2_FIND_INCLUDE_DIR(GDKMM gdkmm.h) @@ -711,21 +705,21 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (GDKMM gdkmm true true) _GTK2_ADD_TARGET (GDKMM GTK2_DEPENDS pangomm gtk glibmm sigc++ gdk atk pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib GTK2_OPTIONAL_DEPENDS giomm cairomm gio - EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) _GTK2_FIND_INCLUDE_DIR(GTKMM gtkmm.h) _GTK2_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h) _GTK2_FIND_LIBRARY (GTKMM gtkmm true true) _GTK2_ADD_TARGET (GTKMM GTK2_DEPENDS atkmm gdkmm pangomm gtk glibmm sigc++ gdk atk pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib GTK2_OPTIONAL_DEPENDS giomm cairomm gio - EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) elseif(_GTK2_component STREQUAL "glade") _GTK2_FIND_INCLUDE_DIR(GLADE glade/glade.h) _GTK2_FIND_LIBRARY (GLADE glade false true) _GTK2_ADD_TARGET (GLADE GTK2_DEPENDS gtk gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib - EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) elseif(_GTK2_component STREQUAL "glademm") @@ -734,7 +728,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_LIBRARY (GLADEMM glademm true true) _GTK2_ADD_TARGET (GLADEMM GTK2_DEPENDS gtkmm glade atkmm gdkmm giomm pangomm glibmm sigc++ gtk gdk atk pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib GTK2_OPTIONAL_DEPENDS giomm cairomm gio - EXTRA_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) + OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) else() message(FATAL_ERROR "Unknown GTK2 component ${_component}") -- cgit v0.12 From 95fc47aa49515d45afcfb609262bd85025fb4a3d Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Thu, 3 Oct 2013 17:26:16 +0200 Subject: FindGTK2: Make pangocairo and cairo optional dependencies --- Modules/FindGTK2.cmake | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index 2f00c56..9d8c41b 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -651,7 +651,8 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) else() _GTK2_FIND_LIBRARY (GDK gdk-win32 false true) endif() - _GTK2_ADD_TARGET (GDK GTK2_DEPENDS pangocairo pango cairo gdk_pixbuf gobject glib) + _GTK2_ADD_TARGET (GDK GTK2_DEPENDS pango gdk_pixbuf gobject glib + GTK2_OPTIONAL_DEPENDS pangocairo cairo) _GTK2_FIND_INCLUDE_DIR(GTK gtk/gtk.h) if(UNIX) @@ -659,8 +660,8 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) else() _GTK2_FIND_LIBRARY (GTK gtk-win32 false true) endif() - _GTK2_ADD_TARGET (GTK GTK2_DEPENDS gdk atk pangoft2 pangocairo pango cairo gdk_pixbuf gthread gobject glib - GTK2_OPTIONAL_DEPENDS gio) + _GTK2_ADD_TARGET (GTK GTK2_DEPENDS gdk atk pangoft2 pango gdk_pixbuf gthread gobject glib + GTK2_OPTIONAL_DEPENDS gio pangocairo cairo) # Left for compatibility with previous versions. It doesn't seem to be required _GTK2_FIND_INCLUDE_DIR(FONTCONFIG fontconfig/fontconfig.h) @@ -695,30 +696,31 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(PANGOMM pangomm.h) _GTK2_FIND_INCLUDE_DIR(PANGOMMCONFIG pangommconfig.h) _GTK2_FIND_LIBRARY (PANGOMM pangomm true true) - _GTK2_ADD_TARGET (PANGOMM GTK2_DEPENDS glibmm pangocairo sigc++ pango cairo gobject glib - GTK2_OPTIONAL_DEPENDS cairomm + _GTK2_ADD_TARGET (PANGOMM GTK2_DEPENDS glibmm sigc++ pango gobject glib + GTK2_OPTIONAL_DEPENDS cairomm pangocairo cairo OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) _GTK2_FIND_INCLUDE_DIR(GDKMM gdkmm.h) _GTK2_FIND_INCLUDE_DIR(GDKMMCONFIG gdkmmconfig.h) _GTK2_FIND_LIBRARY (GDKMM gdkmm true true) - _GTK2_ADD_TARGET (GDKMM GTK2_DEPENDS pangomm gtk glibmm sigc++ gdk atk pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib - GTK2_OPTIONAL_DEPENDS giomm cairomm gio + _GTK2_ADD_TARGET (GDKMM GTK2_DEPENDS pangomm gtk glibmm sigc++ gdk atk pangoft2 gdk_pixbuf pango gobject glib + GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) _GTK2_FIND_INCLUDE_DIR(GTKMM gtkmm.h) _GTK2_FIND_INCLUDE_DIR(GTKMMCONFIG gtkmmconfig.h) _GTK2_FIND_LIBRARY (GTKMM gtkmm true true) - _GTK2_ADD_TARGET (GTKMM GTK2_DEPENDS atkmm gdkmm pangomm gtk glibmm sigc++ gdk atk pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib - GTK2_OPTIONAL_DEPENDS giomm cairomm gio + _GTK2_ADD_TARGET (GTKMM GTK2_DEPENDS atkmm gdkmm pangomm gtk glibmm sigc++ gdk atk pangoft2 gdk_pixbuf pango gthread gobject glib + GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) elseif(_GTK2_component STREQUAL "glade") _GTK2_FIND_INCLUDE_DIR(GLADE glade/glade.h) _GTK2_FIND_LIBRARY (GLADE glade false true) - _GTK2_ADD_TARGET (GLADE GTK2_DEPENDS gtk gdk atk gio pangoft2 pangocairo gdk_pixbuf cairo pango gobject glib + _GTK2_ADD_TARGET (GLADE GTK2_DEPENDS gtk gdk atk gio pangoft2 gdk_pixbuf pango gobject glib + GTK2_OPTIONAL_DEPENDS pangocairo cairo OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) elseif(_GTK2_component STREQUAL "glademm") @@ -726,8 +728,8 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) _GTK2_FIND_INCLUDE_DIR(GLADEMM libglademm.h) _GTK2_FIND_INCLUDE_DIR(GLADEMMCONFIG libglademmconfig.h) _GTK2_FIND_LIBRARY (GLADEMM glademm true true) - _GTK2_ADD_TARGET (GLADEMM GTK2_DEPENDS gtkmm glade atkmm gdkmm giomm pangomm glibmm sigc++ gtk gdk atk pangoft2 pangocairo gdk_pixbuf cairo pango gthread gobject glib - GTK2_OPTIONAL_DEPENDS giomm cairomm gio + _GTK2_ADD_TARGET (GLADEMM GTK2_DEPENDS gtkmm glade atkmm gdkmm giomm pangomm glibmm sigc++ gtk gdk atk pangoft2 gdk_pixbuf pango gthread gobject glib + GTK2_OPTIONAL_DEPENDS giomm cairomm gio pangocairo cairo OPTIONAL_INCLUDES ${FREETYPE_INCLUDE_DIR_ft2build} ${FREETYPE_INCLUDE_DIR_freetype2}) else() -- cgit v0.12 From 7efef02df29399d37b692e01fb69de63e558585b Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Tue, 6 Aug 2013 11:33:59 +0200 Subject: FindGTK2: Add tests for components and targets in gtk and gtkmm modules --- Tests/CMakeLists.txt | 5 + Tests/FindGTK2/CMakeLists.txt | 317 +++++++++++++++++++++++++++++++ Tests/FindGTK2/atk/CMakeLists.txt | 10 + Tests/FindGTK2/atk/main.c | 7 + Tests/FindGTK2/atkmm/CMakeLists.txt | 10 + Tests/FindGTK2/atkmm/main.cpp | 8 + Tests/FindGTK2/cairo/CMakeLists.txt | 10 + Tests/FindGTK2/cairo/main.c | 52 +++++ Tests/FindGTK2/cairomm/CMakeLists.txt | 10 + Tests/FindGTK2/cairomm/main.cpp | 62 ++++++ Tests/FindGTK2/gdk/CMakeLists.txt | 10 + Tests/FindGTK2/gdk/main.c | 7 + Tests/FindGTK2/gdk_pixbuf/CMakeLists.txt | 10 + Tests/FindGTK2/gdk_pixbuf/main.c | 10 + Tests/FindGTK2/gdkmm/CMakeLists.txt | 10 + Tests/FindGTK2/gdkmm/main.cpp | 7 + Tests/FindGTK2/gio/CMakeLists.txt | 10 + Tests/FindGTK2/gio/main.c | 8 + Tests/FindGTK2/giomm/CMakeLists.txt | 10 + Tests/FindGTK2/giomm/main.cpp | 7 + Tests/FindGTK2/glib/CMakeLists.txt | 10 + Tests/FindGTK2/glib/main.c | 11 ++ Tests/FindGTK2/glibmm/CMakeLists.txt | 10 + Tests/FindGTK2/glibmm/main.cpp | 7 + Tests/FindGTK2/gmodule/CMakeLists.txt | 10 + Tests/FindGTK2/gmodule/main.c | 7 + Tests/FindGTK2/gobject/CMakeLists.txt | 10 + Tests/FindGTK2/gobject/main.c | 72 +++++++ Tests/FindGTK2/gthread/CMakeLists.txt | 10 + Tests/FindGTK2/gthread/main.c | 7 + Tests/FindGTK2/gtk/CMakeLists.txt | 14 ++ Tests/FindGTK2/gtk/main.c | 15 ++ Tests/FindGTK2/gtkmm/CMakeLists.txt | 14 ++ Tests/FindGTK2/gtkmm/helloworld.cpp | 29 +++ Tests/FindGTK2/gtkmm/helloworld.h | 20 ++ Tests/FindGTK2/gtkmm/main.cpp | 13 ++ Tests/FindGTK2/pango/CMakeLists.txt | 10 + Tests/FindGTK2/pango/main.c | 7 + Tests/FindGTK2/pangocairo/CMakeLists.txt | 10 + Tests/FindGTK2/pangocairo/main.c | 72 +++++++ Tests/FindGTK2/pangoft2/CMakeLists.txt | 10 + Tests/FindGTK2/pangoft2/main.c | 8 + Tests/FindGTK2/pangomm/CMakeLists.txt | 10 + Tests/FindGTK2/pangomm/main.cpp | 8 + Tests/FindGTK2/pangoxft/CMakeLists.txt | 10 + Tests/FindGTK2/pangoxft/main.c | 7 + Tests/FindGTK2/sigc++/CMakeLists.txt | 10 + Tests/FindGTK2/sigc++/main.cpp | 30 +++ 48 files changed, 1031 insertions(+) create mode 100644 Tests/FindGTK2/CMakeLists.txt create mode 100644 Tests/FindGTK2/atk/CMakeLists.txt create mode 100644 Tests/FindGTK2/atk/main.c create mode 100644 Tests/FindGTK2/atkmm/CMakeLists.txt create mode 100644 Tests/FindGTK2/atkmm/main.cpp create mode 100644 Tests/FindGTK2/cairo/CMakeLists.txt create mode 100644 Tests/FindGTK2/cairo/main.c create mode 100644 Tests/FindGTK2/cairomm/CMakeLists.txt create mode 100644 Tests/FindGTK2/cairomm/main.cpp create mode 100644 Tests/FindGTK2/gdk/CMakeLists.txt create mode 100644 Tests/FindGTK2/gdk/main.c create mode 100644 Tests/FindGTK2/gdk_pixbuf/CMakeLists.txt create mode 100644 Tests/FindGTK2/gdk_pixbuf/main.c create mode 100644 Tests/FindGTK2/gdkmm/CMakeLists.txt create mode 100644 Tests/FindGTK2/gdkmm/main.cpp create mode 100644 Tests/FindGTK2/gio/CMakeLists.txt create mode 100644 Tests/FindGTK2/gio/main.c create mode 100644 Tests/FindGTK2/giomm/CMakeLists.txt create mode 100644 Tests/FindGTK2/giomm/main.cpp create mode 100644 Tests/FindGTK2/glib/CMakeLists.txt create mode 100644 Tests/FindGTK2/glib/main.c create mode 100644 Tests/FindGTK2/glibmm/CMakeLists.txt create mode 100644 Tests/FindGTK2/glibmm/main.cpp create mode 100644 Tests/FindGTK2/gmodule/CMakeLists.txt create mode 100644 Tests/FindGTK2/gmodule/main.c create mode 100644 Tests/FindGTK2/gobject/CMakeLists.txt create mode 100644 Tests/FindGTK2/gobject/main.c create mode 100644 Tests/FindGTK2/gthread/CMakeLists.txt create mode 100644 Tests/FindGTK2/gthread/main.c create mode 100644 Tests/FindGTK2/gtk/CMakeLists.txt create mode 100644 Tests/FindGTK2/gtk/main.c create mode 100644 Tests/FindGTK2/gtkmm/CMakeLists.txt create mode 100644 Tests/FindGTK2/gtkmm/helloworld.cpp create mode 100644 Tests/FindGTK2/gtkmm/helloworld.h create mode 100644 Tests/FindGTK2/gtkmm/main.cpp create mode 100644 Tests/FindGTK2/pango/CMakeLists.txt create mode 100644 Tests/FindGTK2/pango/main.c create mode 100644 Tests/FindGTK2/pangocairo/CMakeLists.txt create mode 100644 Tests/FindGTK2/pangocairo/main.c create mode 100644 Tests/FindGTK2/pangoft2/CMakeLists.txt create mode 100644 Tests/FindGTK2/pangoft2/main.c create mode 100644 Tests/FindGTK2/pangomm/CMakeLists.txt create mode 100644 Tests/FindGTK2/pangomm/main.cpp create mode 100644 Tests/FindGTK2/pangoxft/CMakeLists.txt create mode 100644 Tests/FindGTK2/pangoxft/main.c create mode 100644 Tests/FindGTK2/sigc++/CMakeLists.txt create mode 100644 Tests/FindGTK2/sigc++/main.cpp diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9c3ed59..04b0094 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1070,6 +1070,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ endif() endif() + find_package(GTK2 QUIET) + if(GTK2_FOUND) + add_subdirectory(FindGTK2) + endif() + add_test(ExternalProject ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/ExternalProject" diff --git a/Tests/FindGTK2/CMakeLists.txt b/Tests/FindGTK2/CMakeLists.txt new file mode 100644 index 0000000..1c5987c --- /dev/null +++ b/Tests/FindGTK2/CMakeLists.txt @@ -0,0 +1,317 @@ +find_package(GTK2 COMPONENTS gtk glade gtkmm glademm QUIET) + + +# Test GTK2 components +if(GTK2_GTK_FOUND) + add_test(GTK2Components.gtk ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gtk" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtk" + ${build_generator_args} + --build-target gtk-all-libs + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtk" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(GTK2_GTKMM_FOUND) + add_test(GTK2Components.gtkmm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gtkmm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtkmm" + ${build_generator_args} + --build-target gtkmm-all-libs + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Components/gtkmm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + + +# Test GTK2 targets +if(TARGET GTK2::glib) + add_test(GTK2Targets.glib ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/glib" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/glib" + ${build_generator_args} + --build-project glib + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/glib" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gobject) + add_test(GTK2Targets.gobject ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gobject" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gobject" + ${build_generator_args} + --build-project gobject + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gobject" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gio) + add_test(GTK2Targets.gio ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gio" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gio" + ${build_generator_args} + --build-project gio + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gio" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gmodule) + add_test(GTK2Targets.gmodule ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gmodule" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gmodule" + ${build_generator_args} + --build-project gmodule + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gmodule" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gthread) + add_test(GTK2Targets.gthread ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gthread" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gthread" + ${build_generator_args} + --build-project gthread + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gthread" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::atk) + add_test(GTK2Targets.atk ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/atk" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/atk" + ${build_generator_args} + --build-project atk + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/atk" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gdk_pixbuf) + add_test(GTK2Targets.gdk_pixbuf ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gdk_pixbuf" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gdk_pixbuf" + ${build_generator_args} + --build-project gdk_pixbuf + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gdk_pixbuf" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::cairo) + add_test(GTK2Targets.cairo ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/cairo" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/cairo" + ${build_generator_args} + --build-project cairo + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/cairo" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::pango) + add_test(GTK2Targets.pango ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/pango" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pango" + ${build_generator_args} + --build-project pango + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pango" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::pangocairo) + add_test(GTK2Targets.pangocairo ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/pangocairo" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangocairo" + ${build_generator_args} + --build-project pangocairo + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangocairo" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::pangoxft) + add_test(GTK2Targets.pangoxft ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/pangoxft" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangoxft" + ${build_generator_args} + --build-project pangoxft + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangoxft" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::pangoft2) + add_test(GTK2Targets.pangoft2 ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/pangoft2" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangoft2" + ${build_generator_args} + --build-project pangoft2 + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangoft2" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gdk) + add_test(GTK2Targets.gdk ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gdk" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gdk" + ${build_generator_args} + --build-project gdk + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gdk" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gtk) + add_test(GTK2Targets.gtk ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gtk" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtk" + ${build_generator_args} + --build-project gtk + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtk" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::sigc++) + add_test(GTK2Targets.sigc++ ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/sigc++" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/sigc++" + ${build_generator_args} + --build-project sigc++ + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/sigc++" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::glibmm) + add_test(GTK2Targets.glibmm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/glibmm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/glibmm" + ${build_generator_args} + --build-project glibmm + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/glibmm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::giomm) + add_test(GTK2Targets.giomm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/giomm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/giomm" + ${build_generator_args} + --build-project giomm + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/giomm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::atkmm) + add_test(GTK2Targets.atkmm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/atkmm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/atkmm" + ${build_generator_args} + --build-project atkmm + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/atkmm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::cairomm) + add_test(GTK2Targets.cairomm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/cairomm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/cairomm" + ${build_generator_args} + --build-project cairomm + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/cairomm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::pangomm) + add_test(GTK2Targets.pangomm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/pangomm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangomm" + ${build_generator_args} + --build-project pangomm + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/pangomm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gdkmm) + add_test(GTK2Targets.gdkmm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gdkmm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/GTK2Targets/gdkmm" + ${build_generator_args} + --build-project gdkmm + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/GTK2Targets/gdkmm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() + +if(TARGET GTK2::gtkmm) + add_test(GTK2Targets.gtkmm ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGTK2/gtkmm" + "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtkmm" + ${build_generator_args} + --build-target gtkmm-target + --build-exe-dir "${CMake_BINARY_DIR}/Tests/FindGTK2/GTK2Targets/gtkmm" + --force-new-ctest-process + --test-command ${CMAKE_CTEST_COMMAND} -V + ) +endif() diff --git a/Tests/FindGTK2/atk/CMakeLists.txt b/Tests/FindGTK2/atk/CMakeLists.txt new file mode 100644 index 0000000..be37957 --- /dev/null +++ b/Tests/FindGTK2/atk/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(atk C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(atk WIN32 main.c) +target_link_libraries(atk GTK2::atk) diff --git a/Tests/FindGTK2/atk/main.c b/Tests/FindGTK2/atk/main.c new file mode 100644 index 0000000..e25030e --- /dev/null +++ b/Tests/FindGTK2/atk/main.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + const gchar *name = atk_get_toolkit_name(); + return 0; +} diff --git a/Tests/FindGTK2/atkmm/CMakeLists.txt b/Tests/FindGTK2/atkmm/CMakeLists.txt new file mode 100644 index 0000000..e8320b5 --- /dev/null +++ b/Tests/FindGTK2/atkmm/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(atkmm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(atkmm WIN32 main.cpp) +target_link_libraries(atkmm GTK2::atkmm) diff --git a/Tests/FindGTK2/atkmm/main.cpp b/Tests/FindGTK2/atkmm/main.cpp new file mode 100644 index 0000000..f455c7a --- /dev/null +++ b/Tests/FindGTK2/atkmm/main.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + Atk::init(); + return 0; +} diff --git a/Tests/FindGTK2/cairo/CMakeLists.txt b/Tests/FindGTK2/cairo/CMakeLists.txt new file mode 100644 index 0000000..97a7369 --- /dev/null +++ b/Tests/FindGTK2/cairo/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(cairo C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(cairo WIN32 main.c) +target_link_libraries(cairo GTK2::cairo) diff --git a/Tests/FindGTK2/cairo/main.c b/Tests/FindGTK2/cairo/main.c new file mode 100644 index 0000000..1b61001 --- /dev/null +++ b/Tests/FindGTK2/cairo/main.c @@ -0,0 +1,52 @@ +/* Taken from http://cairographics.org/samples/ */ + + +#include +#include +#include + +int main(int argc, char *argv[]) +{ + char *filename; + if (argc != 2) + { + fprintf (stderr, "Usage: %s OUTPUT_FILENAME\n", argv[0]); + return 1; + } + filename = argv[1]; + double xc = 128.0; + double yc = 128.0; + double radius = 100.0; + double angle1 = 45.0 * (M_PI/180.0); /* angles are specified */ + double angle2 = 180.0 * (M_PI/180.0); /* in radians */ + + cairo_surface_t *im = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, xc * 2, yc * 2); + cairo_t *cr = cairo_create(im); + + + cairo_set_line_width (cr, 10.0); + cairo_arc (cr, xc, yc, radius, angle1, angle2); + cairo_stroke (cr); + + /* draw helping lines */ + cairo_set_source_rgba (cr, 1, 0.2, 0.2, 0.6); + cairo_set_line_width (cr, 6.0); + + cairo_arc (cr, xc, yc, 10.0, 0, 2*M_PI); + cairo_fill (cr); + + cairo_arc (cr, xc, yc, radius, angle1, angle1); + cairo_line_to (cr, xc, yc); + cairo_arc (cr, xc, yc, radius, angle2, angle2); + cairo_line_to (cr, xc, yc); + cairo_stroke (cr); + + cairo_status_t status = cairo_surface_write_to_png (im, filename); + cairo_surface_destroy (im); + if (status != CAIRO_STATUS_SUCCESS) { + fprintf(stderr, "Could not save png to '%s'\n", filename); + } + + cairo_destroy(cr); + return 0; +} diff --git a/Tests/FindGTK2/cairomm/CMakeLists.txt b/Tests/FindGTK2/cairomm/CMakeLists.txt new file mode 100644 index 0000000..47a156e --- /dev/null +++ b/Tests/FindGTK2/cairomm/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(cairomm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(cairomm WIN32 main.cpp) +target_link_libraries(cairomm GTK2::cairomm) diff --git a/Tests/FindGTK2/cairomm/main.cpp b/Tests/FindGTK2/cairomm/main.cpp new file mode 100644 index 0000000..ea8f106 --- /dev/null +++ b/Tests/FindGTK2/cairomm/main.cpp @@ -0,0 +1,62 @@ +// Taken from http://cgit.freedesktop.org/cairomm/plain/examples/surfaces/image-surface.cc + + +/* M_PI is defined in math.h in the case of Microsoft Visual C++, Solaris, + * et. al. + */ +#if defined(_MSC_VER) +#define _USE_MATH_DEFINES +#endif + +#include +#include +#include +#include +#include + +#include + +int main() +{ + Cairo::RefPtr surface = + Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 600, 400); + + Cairo::RefPtr cr = Cairo::Context::create(surface); + + cr->save(); // save the state of the context + cr->set_source_rgb(0.86, 0.85, 0.47); + cr->paint(); // fill image with the color + cr->restore(); // color is back to black now + + cr->save(); + // draw a border around the image + cr->set_line_width(20.0); // make the line wider + cr->rectangle(0.0, 0.0, surface->get_width(), surface->get_height()); + cr->stroke(); + + cr->set_source_rgba(0.0, 0.0, 0.0, 0.7); + // draw a circle in the center of the image + cr->arc(surface->get_width() / 2.0, surface->get_height() / 2.0, + surface->get_height() / 4.0, 0.0, 2.0 * M_PI); + cr->stroke(); + + // draw a diagonal line + cr->move_to(surface->get_width() / 4.0, surface->get_height() / 4.0); + cr->line_to(surface->get_width() * 3.0 / 4.0, surface->get_height() * 3.0 / 4.0); + cr->stroke(); + cr->restore(); + +#ifdef CAIRO_HAS_PNG_FUNCTIONS + + std::string filename = "image.png"; + surface->write_to_png(filename); + + std::cout << "Wrote png file \"" << filename << "\"" << std::endl; + +#else + + std::cout << "You must compile cairo with PNG support for this example to work." + << std::endl; + +#endif +} diff --git a/Tests/FindGTK2/gdk/CMakeLists.txt b/Tests/FindGTK2/gdk/CMakeLists.txt new file mode 100644 index 0000000..f485236 --- /dev/null +++ b/Tests/FindGTK2/gdk/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gdk C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gdk WIN32 main.c) +target_link_libraries(gdk GTK2::gdk) diff --git a/Tests/FindGTK2/gdk/main.c b/Tests/FindGTK2/gdk/main.c new file mode 100644 index 0000000..ac1bd4b --- /dev/null +++ b/Tests/FindGTK2/gdk/main.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + gdk_init(argc, argv); + return 0; +} diff --git a/Tests/FindGTK2/gdk_pixbuf/CMakeLists.txt b/Tests/FindGTK2/gdk_pixbuf/CMakeLists.txt new file mode 100644 index 0000000..004e82e --- /dev/null +++ b/Tests/FindGTK2/gdk_pixbuf/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gdk_pixbuf C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gdk_pixbuf WIN32 main.c) +target_link_libraries(gdk_pixbuf GTK2::gdk_pixbuf) diff --git a/Tests/FindGTK2/gdk_pixbuf/main.c b/Tests/FindGTK2/gdk_pixbuf/main.c new file mode 100644 index 0000000..e42b83e --- /dev/null +++ b/Tests/FindGTK2/gdk_pixbuf/main.c @@ -0,0 +1,10 @@ +#include + +int main(int argc, char *argv[]) +{ + const char *version = gdk_pixbuf_version; + const guint major = gdk_pixbuf_major_version; + const guint minor = gdk_pixbuf_minor_version; + const guint micro = gdk_pixbuf_micro_version; + return 0; +} diff --git a/Tests/FindGTK2/gdkmm/CMakeLists.txt b/Tests/FindGTK2/gdkmm/CMakeLists.txt new file mode 100644 index 0000000..a54fc4f --- /dev/null +++ b/Tests/FindGTK2/gdkmm/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gdkmm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gdkmm WIN32 main.cpp) +target_link_libraries(gdkmm GTK2::gdkmm) diff --git a/Tests/FindGTK2/gdkmm/main.cpp b/Tests/FindGTK2/gdkmm/main.cpp new file mode 100644 index 0000000..935bcc4 --- /dev/null +++ b/Tests/FindGTK2/gdkmm/main.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + Gdk::Color red = Gdk::Color("red"); + return 0; +} diff --git a/Tests/FindGTK2/gio/CMakeLists.txt b/Tests/FindGTK2/gio/CMakeLists.txt new file mode 100644 index 0000000..db9cdd0 --- /dev/null +++ b/Tests/FindGTK2/gio/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gio C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gio WIN32 main.c) +target_link_libraries(gio GTK2::gio) diff --git a/Tests/FindGTK2/gio/main.c b/Tests/FindGTK2/gio/main.c new file mode 100644 index 0000000..13f4304 --- /dev/null +++ b/Tests/FindGTK2/gio/main.c @@ -0,0 +1,8 @@ +#include + +int main(int argc, char *argv[]) +{ + GFile *file = g_file_new_for_path("path"); + g_object_unref(file); + return 0; +} diff --git a/Tests/FindGTK2/giomm/CMakeLists.txt b/Tests/FindGTK2/giomm/CMakeLists.txt new file mode 100644 index 0000000..46cfef5 --- /dev/null +++ b/Tests/FindGTK2/giomm/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(giomm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(giomm WIN32 main.cpp) +target_link_libraries(giomm GTK2::giomm) diff --git a/Tests/FindGTK2/giomm/main.cpp b/Tests/FindGTK2/giomm/main.cpp new file mode 100644 index 0000000..8303ba9 --- /dev/null +++ b/Tests/FindGTK2/giomm/main.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + Glib::RefPtr f = Gio::File::create_for_path("path"); + return 0; +} diff --git a/Tests/FindGTK2/glib/CMakeLists.txt b/Tests/FindGTK2/glib/CMakeLists.txt new file mode 100644 index 0000000..1aa73ff --- /dev/null +++ b/Tests/FindGTK2/glib/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(glib C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(glib WIN32 main.c) +target_link_libraries(glib GTK2::glib) diff --git a/Tests/FindGTK2/glib/main.c b/Tests/FindGTK2/glib/main.c new file mode 100644 index 0000000..80d0554 --- /dev/null +++ b/Tests/FindGTK2/glib/main.c @@ -0,0 +1,11 @@ +#include + +int main(int argc, char *argv[]) +{ + if (!g_file_test("file", G_FILE_TEST_EXISTS)) { + g_print("File not found. \n"); + } else { + g_print("File found. \n"); + } + return 0; +} diff --git a/Tests/FindGTK2/glibmm/CMakeLists.txt b/Tests/FindGTK2/glibmm/CMakeLists.txt new file mode 100644 index 0000000..af8ddcf --- /dev/null +++ b/Tests/FindGTK2/glibmm/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(glibmm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(glibmm WIN32 main.cpp) +target_link_libraries(glibmm GTK2::glibmm) diff --git a/Tests/FindGTK2/glibmm/main.cpp b/Tests/FindGTK2/glibmm/main.cpp new file mode 100644 index 0000000..0e8cdae --- /dev/null +++ b/Tests/FindGTK2/glibmm/main.cpp @@ -0,0 +1,7 @@ +#include + +int main(int, char**) +{ + Glib::init(); + return 0; +} diff --git a/Tests/FindGTK2/gmodule/CMakeLists.txt b/Tests/FindGTK2/gmodule/CMakeLists.txt new file mode 100644 index 0000000..9717da8 --- /dev/null +++ b/Tests/FindGTK2/gmodule/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gmodule C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gmodule WIN32 main.c) +target_link_libraries(gmodule GTK2::gmodule) diff --git a/Tests/FindGTK2/gmodule/main.c b/Tests/FindGTK2/gmodule/main.c new file mode 100644 index 0000000..5c85a6f --- /dev/null +++ b/Tests/FindGTK2/gmodule/main.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + gboolean b = g_module_supported(); + return 0; +} diff --git a/Tests/FindGTK2/gobject/CMakeLists.txt b/Tests/FindGTK2/gobject/CMakeLists.txt new file mode 100644 index 0000000..c51fd4d --- /dev/null +++ b/Tests/FindGTK2/gobject/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gobject C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gobject WIN32 main.c) +target_link_libraries(gobject GTK2::gobject) diff --git a/Tests/FindGTK2/gobject/main.c b/Tests/FindGTK2/gobject/main.c new file mode 100644 index 0000000..d3e13f9 --- /dev/null +++ b/Tests/FindGTK2/gobject/main.c @@ -0,0 +1,72 @@ +/* Taken from https://developer.gnome.org/gobject/stable/chapter-gobject.html */ + + +#include + + +#define MAMAN_TYPE_BAR (maman_bar_get_type ()) +#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar)) +#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR)) +#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass)) +#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR)) +#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass)) + +typedef struct _MamanBar MamanBar; +typedef struct _MamanBarClass MamanBarClass; + +struct _MamanBar +{ + GObject parent_instance; + + /* instance members */ +}; + +struct _MamanBarClass +{ + GObjectClass parent_class; + + /* class members */ +}; + +/* will create maman_bar_get_type and set maman_bar_parent_class */ +G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT); + +static GObject * +maman_bar_constructor (GType gtype, + guint n_properties, + GObjectConstructParam *properties) +{ + GObject *obj; + + { + /* Always chain up to the parent constructor */ + obj = G_OBJECT_CLASS (maman_bar_parent_class)->constructor (gtype, n_properties, properties); + } + + /* update the object state depending on constructor properties */ + + return obj; +} + +static void +maman_bar_class_init (MamanBarClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->constructor = maman_bar_constructor; +} + +static void +maman_bar_init (MamanBar *self) +{ + /* initialize the object */ +} + + +int +main(int argc, char *argv[]) +{ + MamanBar *bar = g_object_new (MAMAN_TYPE_BAR, NULL); + g_object_unref(bar); + return 0; +} diff --git a/Tests/FindGTK2/gthread/CMakeLists.txt b/Tests/FindGTK2/gthread/CMakeLists.txt new file mode 100644 index 0000000..a90294d0 --- /dev/null +++ b/Tests/FindGTK2/gthread/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(gthread C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gthread WIN32 main.c) +target_link_libraries(gthread GTK2::gthread) diff --git a/Tests/FindGTK2/gthread/main.c b/Tests/FindGTK2/gthread/main.c new file mode 100644 index 0000000..ce68cbd --- /dev/null +++ b/Tests/FindGTK2/gthread/main.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + g_thread_init(NULL); + return 0; +} diff --git a/Tests/FindGTK2/gtk/CMakeLists.txt b/Tests/FindGTK2/gtk/CMakeLists.txt new file mode 100644 index 0000000..11603ae --- /dev/null +++ b/Tests/FindGTK2/gtk/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 2.8) + +project(gtk C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gtk WIN32 main.c) +target_link_libraries(gtk GTK2::gtk) + +add_executable(gtk-all-libs WIN32 main.c) +target_link_libraries(gtk-all-libs ${GTK2_LIBRARIES}) +target_include_directories(gtk-all-libs PRIVATE ${GTK2_INCLUDE_DIRS}) diff --git a/Tests/FindGTK2/gtk/main.c b/Tests/FindGTK2/gtk/main.c new file mode 100644 index 0000000..309c328 --- /dev/null +++ b/Tests/FindGTK2/gtk/main.c @@ -0,0 +1,15 @@ +#include + +int main(int argc, char *argv[]) +{ + GtkWidget *window; + + gtk_init (&argc, &argv); + + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_show (window); + + gtk_main (); + + return 0; +} diff --git a/Tests/FindGTK2/gtkmm/CMakeLists.txt b/Tests/FindGTK2/gtkmm/CMakeLists.txt new file mode 100644 index 0000000..32aafe2 --- /dev/null +++ b/Tests/FindGTK2/gtkmm/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 2.8) + +project(gtkmm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(gtkmm-target WIN32 main.cpp helloworld.cpp helloworld.h) +target_link_libraries(gtkmm-target GTK2::gtkmm) + +add_executable(gtkmm-all-libs WIN32 main.cpp helloworld.cpp helloworld.h) +target_link_libraries(gtkmm-all-libs ${GTK2_LIBRARIES}) +target_include_directories(gtkmm-all-libs PRIVATE ${GTK2_INCLUDE_DIRS}) diff --git a/Tests/FindGTK2/gtkmm/helloworld.cpp b/Tests/FindGTK2/gtkmm/helloworld.cpp new file mode 100644 index 0000000..535f44a --- /dev/null +++ b/Tests/FindGTK2/gtkmm/helloworld.cpp @@ -0,0 +1,29 @@ +#include "helloworld.h" +#include + +HelloWorld::HelloWorld() + : m_button("Hello World") // creates a new button with label "Hello World". +{ + // Sets the border width of the window. + set_border_width(10); + + // When the button receives the "clicked" signal, it will call the + // on_button_clicked() method defined below. + m_button.signal_clicked().connect(sigc::mem_fun(*this, + &HelloWorld::on_button_clicked)); + + // This packs the button into the Window (a container). + add(m_button); + + // The final step is to display this newly created widget... + m_button.show(); +} + +HelloWorld::~HelloWorld() +{ +} + +void HelloWorld::on_button_clicked() +{ + std::cout << "Hello World" << std::endl; +} diff --git a/Tests/FindGTK2/gtkmm/helloworld.h b/Tests/FindGTK2/gtkmm/helloworld.h new file mode 100644 index 0000000..ab9a076 --- /dev/null +++ b/Tests/FindGTK2/gtkmm/helloworld.h @@ -0,0 +1,20 @@ +#ifndef GTKMM_EXAMPLE_HELLOWORLD_H +#define GTKMM_EXAMPLE_HELLOWORLD_H + +#include + +class HelloWorld : public Gtk::Window +{ +public: + HelloWorld(); + virtual ~HelloWorld(); + +protected: + //Signal handlers: + void on_button_clicked(); + + //Member widgets: + Gtk::Button m_button; +}; + +#endif // GTKMM_EXAMPLE_HELLOWORLD_H diff --git a/Tests/FindGTK2/gtkmm/main.cpp b/Tests/FindGTK2/gtkmm/main.cpp new file mode 100644 index 0000000..5ff64d1 --- /dev/null +++ b/Tests/FindGTK2/gtkmm/main.cpp @@ -0,0 +1,13 @@ +#include +#include "helloworld.h" + +int main(int argc, char *argv[]) +{ + Gtk::Main kit(argc, argv); + + HelloWorld helloworld; + //Shows the window and returns when it is closed. + Gtk::Main::run(helloworld); + + return 0; +} diff --git a/Tests/FindGTK2/pango/CMakeLists.txt b/Tests/FindGTK2/pango/CMakeLists.txt new file mode 100644 index 0000000..af382a4 --- /dev/null +++ b/Tests/FindGTK2/pango/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(pango C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(pango WIN32 main.c) +target_link_libraries(pango GTK2::pango) diff --git a/Tests/FindGTK2/pango/main.c b/Tests/FindGTK2/pango/main.c new file mode 100644 index 0000000..ef87ce4 --- /dev/null +++ b/Tests/FindGTK2/pango/main.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + gboolean ret = pango_color_parse(NULL, "#ffffff"); + return 0; +} diff --git a/Tests/FindGTK2/pangocairo/CMakeLists.txt b/Tests/FindGTK2/pangocairo/CMakeLists.txt new file mode 100644 index 0000000..8f61379 --- /dev/null +++ b/Tests/FindGTK2/pangocairo/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(pangocairo C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(pangocairo WIN32 main.c) +target_link_libraries(pangocairo GTK2::pangocairo m) diff --git a/Tests/FindGTK2/pangocairo/main.c b/Tests/FindGTK2/pangocairo/main.c new file mode 100644 index 0000000..78268d6 --- /dev/null +++ b/Tests/FindGTK2/pangocairo/main.c @@ -0,0 +1,72 @@ +/* Taken from https://developer.gnome.org/pango/stable/pango-Cairo-Rendering.html */ + + +#include +#include +static void +draw_text (cairo_t *cr) +{ +#define RADIUS 150 +#define N_WORDS 10 +#define FONT "Sans Bold 27" + PangoLayout *layout; + PangoFontDescription *desc; + int i; + /* Center coordinates on the middle of the region we are drawing + */ + cairo_translate (cr, RADIUS, RADIUS); + /* Create a PangoLayout, set the font and text */ + layout = pango_cairo_create_layout (cr); + pango_layout_set_text (layout, "Text", -1); + desc = pango_font_description_from_string (FONT); + pango_layout_set_font_description (layout, desc); + pango_font_description_free (desc); + /* Draw the layout N_WORDS times in a circle */ + for (i = 0; i < N_WORDS; i++) + { + int width, height; + double angle = (360. * i) / N_WORDS; + double red; + cairo_save (cr); + /* Gradient from red at angle == 60 to blue at angle == 240 */ + red = (1 + cos ((angle - 60) * G_PI / 180.)) / 2; + cairo_set_source_rgb (cr, red, 0, 1.0 - red); + cairo_rotate (cr, angle * G_PI / 180.); + /* Inform Pango to re-layout the text with the new transformation */ + pango_cairo_update_layout (cr, layout); + pango_layout_get_size (layout, &width, &height); + cairo_move_to (cr, - ((double)width / PANGO_SCALE) / 2, - RADIUS); + pango_cairo_show_layout (cr, layout); + cairo_restore (cr); + } + /* free the layout object */ + g_object_unref (layout); +} +int main (int argc, char **argv) +{ + cairo_t *cr; + char *filename; + cairo_status_t status; + cairo_surface_t *surface; + if (argc != 2) + { + g_printerr ("Usage: cairosimple OUTPUT_FILENAME\n"); + return 1; + } + filename = argv[1]; + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + 2 * RADIUS, 2 * RADIUS); + cr = cairo_create (surface); + cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); + cairo_paint (cr); + draw_text (cr); + cairo_destroy (cr); + status = cairo_surface_write_to_png (surface, filename); + cairo_surface_destroy (surface); + if (status != CAIRO_STATUS_SUCCESS) + { + g_printerr ("Could not save png to '%s'\n", filename); + return 1; + } + return 0; +} diff --git a/Tests/FindGTK2/pangoft2/CMakeLists.txt b/Tests/FindGTK2/pangoft2/CMakeLists.txt new file mode 100644 index 0000000..0f84c7f --- /dev/null +++ b/Tests/FindGTK2/pangoft2/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(pangoft2 C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(pangoft2 WIN32 main.c) +target_link_libraries(pangoft2 GTK2::pangoft2) diff --git a/Tests/FindGTK2/pangoft2/main.c b/Tests/FindGTK2/pangoft2/main.c new file mode 100644 index 0000000..cf3459e --- /dev/null +++ b/Tests/FindGTK2/pangoft2/main.c @@ -0,0 +1,8 @@ +#include + +int main(int argc, char *argv[]) +{ + PangoFontMap* pfm = pango_ft2_font_map_new(); + g_object_unref(pfm); + return 0; +} diff --git a/Tests/FindGTK2/pangomm/CMakeLists.txt b/Tests/FindGTK2/pangomm/CMakeLists.txt new file mode 100644 index 0000000..3650c50 --- /dev/null +++ b/Tests/FindGTK2/pangomm/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(pangomm CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(pangomm WIN32 main.cpp) +target_link_libraries(pangomm GTK2::pangomm) diff --git a/Tests/FindGTK2/pangomm/main.cpp b/Tests/FindGTK2/pangomm/main.cpp new file mode 100644 index 0000000..32ec914 --- /dev/null +++ b/Tests/FindGTK2/pangomm/main.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + Pango::init(); + return 0; +} diff --git a/Tests/FindGTK2/pangoxft/CMakeLists.txt b/Tests/FindGTK2/pangoxft/CMakeLists.txt new file mode 100644 index 0000000..0db16b1 --- /dev/null +++ b/Tests/FindGTK2/pangoxft/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(pangoxft C) + +find_package(GTK2 COMPONENTS gtk REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(pangoxft WIN32 main.c) +target_link_libraries(pangoxft GTK2::pangoxft) diff --git a/Tests/FindGTK2/pangoxft/main.c b/Tests/FindGTK2/pangoxft/main.c new file mode 100644 index 0000000..cb04f61 --- /dev/null +++ b/Tests/FindGTK2/pangoxft/main.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + pango_xft_get_context(NULL, 0); + return 0; +} diff --git a/Tests/FindGTK2/sigc++/CMakeLists.txt b/Tests/FindGTK2/sigc++/CMakeLists.txt new file mode 100644 index 0000000..f830b81 --- /dev/null +++ b/Tests/FindGTK2/sigc++/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +project(sigc++ CXX) + +find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_executable(sigc++ WIN32 main.cpp) +target_link_libraries(sigc++ GTK2::sigc++) diff --git a/Tests/FindGTK2/sigc++/main.cpp b/Tests/FindGTK2/sigc++/main.cpp new file mode 100644 index 0000000..78428e7 --- /dev/null +++ b/Tests/FindGTK2/sigc++/main.cpp @@ -0,0 +1,30 @@ +// Taken from https://developer.gnome.org/libsigc++-tutorial/stable/ch02.html + + +#include +#include + +class AlienDetector +{ +public: + AlienDetector() {} + + void run() {} + + sigc::signal signal_detected; +}; + +void warn_people() +{ + std::cout << "There are aliens in the carpark!" << std::endl; +} + +int main() +{ + AlienDetector mydetector; + mydetector.signal_detected.connect( sigc::ptr_fun(warn_people) ); + + mydetector.run(); + + return 0; +} -- cgit v0.12