Skip to content

Commit

Permalink
added WXWIDGETS_VERSION to firce wx version, added WXWIDGETS_EXTRA_PA…
Browse files Browse the repository at this point in the history
…TH to search installed wx in extrapath
  • Loading branch information
fszontagh committed Dec 6, 2024
1 parent cf6af7d commit ee0bd4b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
27 changes: 18 additions & 9 deletions cmake/wxWidgets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,45 @@ if (NOT WIN32)

set(wxWidgets_USE_STATIC ON)
set(wxBUILD_SHARED OFF)
option(wxWidgets_EXTRA_PATH "wxWidget extra search path" OFF)
set(WXWIDGETS_EXTRA_PATH "" CACHE STRING "wxWidget extra search path, default: \"\"")


set(wxWidgets_TYPE "system")

find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
pkg_check_modules(PANGO REQUIRED pango)

find_package(wxWidgets ${WXWIDGETS_VERSION} QUIET
PATHS ${wxWidgets_EXTRA_PATH}
)

if (NOT WXWIDGETS_EXTRA_PATH STREQUAL "")

find_package(wxWidgets ${WXWIDGETS_VERSION} QUIET
PATHS ${WXWIDGETS_EXTRA_PATH})
else()
find_package(wxWidgets ${WXWIDGETS_VERSION} QUIET)
endif()




if (NOT wxWidgets_FOUND)

message(STATUS "wxWidgets not found, downloading...")
message(STATUS "wxWidgets not found, using fetch content with tag v${WXWIDGETS_VERSION}")
set(wxWidgets_TYPE "download")

FetchContent_Declare(
wxWidgets
GIT_REPOSITORY https://github.com/wxWidgets/wxWidgets.git
GIT_TAG "v${WXWIDGETS_VERSION}"
EXCLUDE_FROM_ALL
FIND_PACKAGE_ARGS NAMES wxWidgets
)
FetchContent_MakeAvailable(wxWidgets)

if(NOT wxwidgets_POPULATED)
FetchContent_Populate(wxwidgets)
add_subdirectory(${wxwidgets_SOURCE_DIR} ${wxwidgets_BUILD_DIR} EXCLUDE_FROM_ALL)
endif()
find_package(wxWidgets ${WXWIDGETS_VERSION} REQUIRED)

endif(NOT wxWidgets_FOUND)
else()
Expand All @@ -40,6 +49,6 @@ endif(NOT WIN32)

if (NOT wxWidgets_FOUND)
message(FATAL_ERROR "wxWidgets not found")
else()
message(STATUS "wxWidgets found: ${wxWidgets_VERSION} ${wxWidgets_TYPE}")
endif(NOT wxWidgets_FOUND)
else()
message(STATUS "wxWidgets found: ${wxWidgets_VERSION} ${wxWidgets_TYPE} ${wxWidgets_DIR}")
endif()
2 changes: 1 addition & 1 deletion cmake/wxWidgets_version.cmake
Original file line number Diff line number Diff line change
@@ -1 +1 @@
set(WXWIDGETS_VERSION "3.2.6")
set(WXWIDGETS_VERSION "3.2.6" CACHE STRING "wxWidget forced version, default: 3.2.6")

0 comments on commit ee0bd4b

Please sign in to comment.