cmake: Specify the gtk version being used with wx

Fixes potential compilation issues due to gtk3 and gtk2 being used at
the same time.
This commit is contained in:
Jonathan Li 2020-11-03 13:13:06 +00:00
parent a15d3d5811
commit dca272e12d
1 changed files with 8 additions and 7 deletions

View File

@ -39,12 +39,13 @@ endif()
# I'm removing the version check, because it excludes newer versions and requires specifically 3.0.
#list(APPEND wxWidgets_CONFIG_OPTIONS --version=3.0)
# Let's not specifically require Gtk 2 or 3, either. As long as you have wx there...
#if(GTK2_API AND NOT APPLE)
# list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk2)
#elseif(NOT APPLE)
# list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk3)
#endif()
# The wx version must be specified so a mix of gtk2 and gtk3 isn't used
# as that can cause compile errors.
if(GTK2_API AND NOT APPLE)
list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk2)
elseif(NOT APPLE)
list(APPEND wxWidgets_CONFIG_OPTIONS --toolkit=gtk3)
endif()
# wx2.8 => /usr/bin/wx-config-2.8
# lib32-wx2.8 => /usr/bin/wx-config32-2.8
@ -81,7 +82,7 @@ else()
if(EXISTS "/usr/bin/wx-config")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config")
endif()
if(EXISTS "/usr/bin/wx-config-gtk3")
if(NOT GTK2_API AND EXISTS "/usr/bin/wx-config-gtk3")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/bin/wx-config-gtk3")
endif()
endif()