FindGTK2: Add GTK2_DEFINITIONS variable

According to https://wiki.gnome.org/gtkmm/MSWindows on MSVC the /vd2
flag should be passed to the compiler in order to use gtkmm
This commit is contained in:
Daniele E. Domenichelli 2013-06-29 16:44:54 +02:00
parent e021d33f9c
commit 60e4555c89
1 changed files with 17 additions and 0 deletions

View File

@ -18,6 +18,7 @@
# GTK2_FOUND - Were all of your specified components found? # GTK2_FOUND - Were all of your specified components found?
# GTK2_INCLUDE_DIRS - All include directories # GTK2_INCLUDE_DIRS - All include directories
# GTK2_LIBRARIES - All libraries # GTK2_LIBRARIES - All libraries
# GTK2_DEFINITIONS - Additional compiler flags
# #
# GTK2_VERSION - The version of GTK2 found (x.y.z) # GTK2_VERSION - The version of GTK2 found (x.y.z)
# GTK2_MAJOR_VERSION - The major version of GTK2 # GTK2_MAJOR_VERSION - The major version of GTK2
@ -374,6 +375,7 @@ endfunction()
set(GTK2_FOUND) set(GTK2_FOUND)
set(GTK2_INCLUDE_DIRS) set(GTK2_INCLUDE_DIRS)
set(GTK2_LIBRARIES) set(GTK2_LIBRARIES)
set(GTK2_DEFINITIONS)
if(NOT GTK2_FIND_COMPONENTS) if(NOT GTK2_FIND_COMPONENTS)
# Assume they only want GTK # Assume they only want GTK
@ -541,6 +543,20 @@ if(NOT GTK2_FIND_VERSION AND GTK2_GTK_INCLUDE_DIR)
set(GTK2_VERSION ${GTK2_MAJOR_VERSION}.${GTK2_MINOR_VERSION}.${GTK2_PATCH_VERSION}) set(GTK2_VERSION ${GTK2_MAJOR_VERSION}.${GTK2_MINOR_VERSION}.${GTK2_PATCH_VERSION})
endif() 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 # Try to enforce components
# #
@ -609,6 +625,7 @@ else()
set(GTK2_VERSION_PATCH) set(GTK2_VERSION_PATCH)
set(GTK2_INCLUDE_DIRS) set(GTK2_INCLUDE_DIRS)
set(GTK2_LIBRARIES) set(GTK2_LIBRARIES)
set(GTK2_DEFINITIONS)
endif() endif()
if(GTK2_INCLUDE_DIRS) if(GTK2_INCLUDE_DIRS)