Skip to content

Commit

Permalink
cmake: fix regression in finding wx from 2efcb62
Browse files Browse the repository at this point in the history
Clear FindwxWidgets module variables from the cache after each
unsuccessful try with WX_CONFIG_EXECUTABLE set, otherwise the succeeding
find_package(wxWidgets) call with WX_CONFIG_EXECUTABLE unset will fail,
as it does with cmake on gentoo.
  • Loading branch information
rkitover committed Aug 4, 2018
1 parent 594ecc3 commit f78d45c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/wx/CMakeLists.txt
Expand Up @@ -65,6 +65,14 @@ function(normalize_wx_paths)
endif()
endfunction()

function(clear_wx_vars)
unset(wxWidgets_FOUND PARENT_SCOPE CACHE FORCE)
unset(wxWidgets_INCLUDE_DIRS PARENT_SCOPE CACHE FORCE)
unset(wxWidgets_LIBRARIES PARENT_SCOPE CACHE FORCE)
unset(wxWidgets_LIBRARY_DIRS PARENT_SCOPE CACHE FORCE)
unset(wxWidgets_CXX_FLAGS PARENT_SCOPE CACHE FORCE)
endfunction()

if(CMAKE_PREFIX_PATH)
set(wxWidgets_CONFIG_OPTIONS "--prefix=${CMAKE_PREFIX_PATH}")
endif()
Expand All @@ -87,6 +95,7 @@ if("$ENV{WX_CONFIG}" STREQUAL "")
if(wxWidgets_FOUND)
break()
endif()
clear_wx_vars()
endforeach()

if(NOT wxWidgets_FOUND)
Expand Down

0 comments on commit f78d45c

Please sign in to comment.