Merge topic 'FindwxWidgets-updates'

d8e233d8 Help: Add notes for topic 'FindwxWidgets-updates'
15aacb68 FindwxWidgets: Add wxWidgets webview component
8122fbd0 FindwxWidgets: Expect wxWidgets 3.1
6089fde5 FindwxWidgets: allow specifying required version
This commit is contained in:
Brad King 2015-09-10 11:29:54 -04:00 committed by CMake Topic Stage
commit bae6eee13a
2 changed files with 38 additions and 5 deletions

View File

@ -0,0 +1,4 @@
FindwxWidgets-updates
---------------------
* The :module:`FindwxWidgets` module learned to support version requests.

View File

@ -302,6 +302,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Find wxWidgets multilib base libraries. # Find wxWidgets multilib base libraries.
find_library(WX_base${_DBG} find_library(WX_base${_DBG}
NAMES NAMES
wxbase31${_UCD}${_DBG}
wxbase30${_UCD}${_DBG} wxbase30${_UCD}${_DBG}
wxbase29${_UCD}${_DBG} wxbase29${_UCD}${_DBG}
wxbase28${_UCD}${_DBG} wxbase28${_UCD}${_DBG}
@ -315,6 +316,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
foreach(LIB net odbc xml) foreach(LIB net odbc xml)
find_library(WX_${LIB}${_DBG} find_library(WX_${LIB}${_DBG}
NAMES NAMES
wxbase31${_UCD}${_DBG}_${LIB}
wxbase30${_UCD}${_DBG}_${LIB} wxbase30${_UCD}${_DBG}_${LIB}
wxbase29${_UCD}${_DBG}_${LIB} wxbase29${_UCD}${_DBG}_${LIB}
wxbase28${_UCD}${_DBG}_${LIB} wxbase28${_UCD}${_DBG}_${LIB}
@ -330,6 +332,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Find wxWidgets monolithic library. # Find wxWidgets monolithic library.
find_library(WX_mono${_DBG} find_library(WX_mono${_DBG}
NAMES NAMES
wxmsw${_UNV}31${_UCD}${_DBG}
wxmsw${_UNV}30${_UCD}${_DBG} wxmsw${_UNV}30${_UCD}${_DBG}
wxmsw${_UNV}29${_UCD}${_DBG} wxmsw${_UNV}29${_UCD}${_DBG}
wxmsw${_UNV}28${_UCD}${_DBG} wxmsw${_UNV}28${_UCD}${_DBG}
@ -346,6 +349,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
stc ribbon propgrid webview) stc ribbon propgrid webview)
find_library(WX_${LIB}${_DBG} find_library(WX_${LIB}${_DBG}
NAMES NAMES
wxmsw${_UNV}31${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}30${_UCD}${_DBG}_${LIB} wxmsw${_UNV}30${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}29${_UCD}${_DBG}_${LIB} wxmsw${_UNV}29${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}28${_UCD}${_DBG}_${LIB} wxmsw${_UNV}28${_UCD}${_DBG}_${LIB}
@ -386,7 +390,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Clear wxWidgets multilib libraries. # Clear wxWidgets multilib libraries.
foreach(LIB core adv aui html media xrc dbgrid gl qa richtext foreach(LIB core adv aui html media xrc dbgrid gl qa richtext
stc ribbon propgrid) webview stc ribbon propgrid)
WX_CLEAR_LIB(WX_${LIB}${_DBG}) WX_CLEAR_LIB(WX_${LIB}${_DBG})
endforeach() endforeach()
endmacro() endmacro()
@ -741,7 +745,7 @@ else()
#----------------------------------------------------------------- #-----------------------------------------------------------------
# Support cross-compiling, only search in the target platform. # Support cross-compiling, only search in the target platform.
find_program(wxWidgets_CONFIG_EXECUTABLE find_program(wxWidgets_CONFIG_EXECUTABLE
NAMES wx-config wx-config-3.0 wx-config-2.9 wx-config-2.8 NAMES wx-config wx-config-3.1 wx-config-3.0 wx-config-2.9 wx-config-2.8
DOC "Location of wxWidgets library configuration provider binary (wx-config)." DOC "Location of wxWidgets library configuration provider binary (wx-config)."
ONLY_CMAKE_FIND_ROOT_PATH ONLY_CMAKE_FIND_ROOT_PATH
) )
@ -857,6 +861,28 @@ else()
endif() endif()
endif() endif()
# Check if a specfic version was requested by find_package().
if(wxWidgets_FOUND)
find_file(_filename wx/version.h PATHS ${wxWidgets_INCLUDE_DIRS} NO_DEFAULT_PATH)
dbg_msg("_filename: ${_filename}")
if(NOT _filename)
message(FATAL_ERROR "wxWidgets wx/version.h file not found in ${wxWidgets_INCLUDE_DIRS}.")
endif()
file(READ ${_filename} _wx_version_h)
string(REGEX REPLACE "^(.*\n)?#define +wxMAJOR_VERSION +([0-9]+).*"
"\\2" wxWidgets_VERSION_MAJOR "${_wx_version_h}" )
string(REGEX REPLACE "^(.*\n)?#define +wxMINOR_VERSION +([0-9]+).*"
"\\2" wxWidgets_VERSION_MINOR "${_wx_version_h}" )
string(REGEX REPLACE "^(.*\n)?#define +wxRELEASE_NUMBER +([0-9]+).*"
"\\2" wxWidgets_VERSION_PATCH "${_wx_version_h}" )
set(wxWidgets_VERSION_STRING
"${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}.${wxWidgets_VERSION_PATCH}" )
dbg_msg("wxWidgets_VERSION_STRING: ${wxWidgets_VERSION_STRING}")
endif()
# Debug output: # Debug output:
DBG_MSG("wxWidgets_FOUND : ${wxWidgets_FOUND}") DBG_MSG("wxWidgets_FOUND : ${wxWidgets_FOUND}")
DBG_MSG("wxWidgets_INCLUDE_DIRS : ${wxWidgets_INCLUDE_DIRS}") DBG_MSG("wxWidgets_INCLUDE_DIRS : ${wxWidgets_INCLUDE_DIRS}")
@ -867,10 +893,13 @@ DBG_MSG("wxWidgets_USE_FILE : ${wxWidgets_USE_FILE}")
#===================================================================== #=====================================================================
#===================================================================== #=====================================================================
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(wxWidgets DEFAULT_MSG wxWidgets_FOUND)
# Maintain consistency with all other variables. find_package_handle_standard_args(wxWidgets
set(wxWidgets_FOUND ${WXWIDGETS_FOUND}) REQUIRED_VARS wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS
VERSION_VAR wxWidgets_VERSION_STRING
)
#===================================================================== #=====================================================================
# Macros for use in wxWidgets apps. # Macros for use in wxWidgets apps.