Skip to content

Commit

Permalink
simplify check for renamed wx-config, fix gentoo
Browse files Browse the repository at this point in the history
Use find_program() to check for the existance of wx-config-gtk4, then
wx-config-gtk3 and finally wx-config, instead of calling find_package()
for each separately, FindwxWidgets module does not like being called
multiple times, it screws up some cache variables.
  • Loading branch information
rkitover committed Aug 6, 2018
1 parent 3b44a29 commit be508eb
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions src/wx/CMakeLists.txt
Expand Up @@ -65,14 +65,6 @@ function(normalize_wx_paths)
endif()
endfunction()

macro(clear_wx_vars)
unset(wxWidgets_FOUND CACHE)
unset(wxWidgets_INCLUDE_DIRS CACHE)
unset(wxWidgets_LIBRARIES CACHE)
unset(wxWidgets_LIBRARY_DIRS CACHE)
unset(wxWidgets_CXX_FLAGS CACHE)
endmacro()

if(CMAKE_PREFIX_PATH)
set(wxWidgets_CONFIG_OPTIONS "--prefix=${CMAKE_PREFIX_PATH}")
endif()
Expand All @@ -88,19 +80,8 @@ set(wxWidgets_USE_LIBS xrc xml html adv net core base)
# wx-config utility for these packages to e.g. wx-config-gtk3
#
# Do not do the check if the WX_CONFIG env var is set.
if("$ENV{WX_CONFIG}" STREQUAL "")
foreach(gtk_ver 4 3)
set(wxWidgets_CONFIG_EXECUTABLE wx-config-gtk${gtk_ver})
find_package(wxWidgets QUIET)
if(wxWidgets_FOUND)
break()
endif()
clear_wx_vars()
endforeach()

if(NOT wxWidgets_FOUND)
unset(wxWidgets_CONFIG_EXECUTABLE)
endif()
if(NOT WIN32 AND NOT APPLE AND "$ENV{WX_CONFIG}" STREQUAL "")
find_program(wxWidgets_CONFIG_EXECUTABLE NAMES wx-config-gtk4 wx-config-gtk3 wx-config)
endif()

# the gl lib may not be available, and if it looks like it is we still have to
Expand Down

0 comments on commit be508eb

Please sign in to comment.