From dca272e12dfa10653a137ac36317f6ead7bcfba3 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Tue, 3 Nov 2020 13:13:06 +0000 Subject: [PATCH] cmake: Specify the gtk version being used with wx Fixes potential compilation issues due to gtk3 and gtk2 being used at the same time. --- cmake/SearchForStuff.cmake | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 1a53942ae9..0ad848b04d 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -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()