FindGTK2: Better handling of include directories

Add a method _GTK2_ADD_TARGET_INCLUDE_DIRS to handle it.
This commit is contained in:
Daniele E. Domenichelli 2013-08-02 18:16:48 +02:00 committed by Brad King
parent 9905abd150
commit 0bc3763c9e
1 changed files with 15 additions and 13 deletions

View File

@ -466,6 +466,15 @@ function(_GTK2_ADD_TARGET_DEPENDS _var)
endforeach() endforeach()
endfunction() 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_GTHREAD glib)
_GTK2_ADD_TARGET_DEPENDS(GTK2_GMODULE glib) _GTK2_ADD_TARGET_DEPENDS(GTK2_GMODULE glib)
_GTK2_ADD_TARGET_DEPENDS(GTK2_GDK_PIXBUF gobject glib) _GTK2_ADD_TARGET_DEPENDS(GTK2_GDK_PIXBUF gobject glib)
#_GTK2_ADD_TARGET_DEPENDS(GTK2_CAIRO) _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_CAIRO ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS})
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_PANGO gobject glib)
_GTK2_ADD_TARGET_DEPENDS(GTK2_PANGOCAIRO pango cairo 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_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_FIND_LIBRARY (GTK2_SIGC++ sigc true true)
_GTK2_ADJUST_LIB_VARS (GTK2_SIGC++) _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_GLIBMM gobject sigc glib)
_GTK2_ADD_TARGET_DEPENDS(GTK2_GIOMM gio 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_ATKMM atk glibmm gobject sigc glib)
_GTK2_ADD_TARGET_DEPENDS(GTK2_CAIROMM cairo sigc++) _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_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_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}") _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_GDKMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_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) _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}") _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_GTKMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS})
set_property(TARGET GTK2::gtkmm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}")
elseif(_GTK2_component STREQUAL "glade") elseif(_GTK2_component STREQUAL "glade")
@ -694,8 +698,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
_GTK2_FIND_LIBRARY (GTK2_GLADE glade false true) _GTK2_FIND_LIBRARY (GTK2_GLADE glade false true)
_GTK2_ADJUST_LIB_VARS (GTK2_GLADE) _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_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}") _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_GLADE ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS})
set_property(TARGET GTK2::glade APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}")
elseif(_GTK2_component STREQUAL "glademm") 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_INCLUDE_DIR(GTK2_GLADEMMCONFIG libglademmconfig.h)
_GTK2_FIND_LIBRARY (GTK2_GLADEMM glademm true true) _GTK2_FIND_LIBRARY (GTK2_GLADEMM glademm true true)
_GTK2_ADJUST_LIB_VARS (GTK2_GLADEMM) _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) _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)
set_property(TARGET GTK2::glademm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}") _GTK2_ADD_TARGET_INCLUDE_DIRS(GTK2_GLADEMM ${FREETYPE_INCLUDE_DIRS} ${GTK2_FONTCONFIG_INCLUDE_DIRS})
set_property(TARGET GTK2::glademm APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_FONTCONFIG_INCLUDE_DIRS}")
else() else()
message(FATAL_ERROR "Unknown GTK2 component ${_component}") message(FATAL_ERROR "Unknown GTK2 component ${_component}")