FindwxWidgets.cmake: Remove arguments from else() and end*()

To reduce differences with upstream FindwxWidgets.cmake, use their style of
ending blocks.
This commit is contained in:
Simon Richter 2016-02-15 18:48:40 +01:00
parent 5b1a5cbdce
commit 86d072b5d1
1 changed files with 101 additions and 103 deletions

View File

@ -151,10 +151,10 @@
# two versions for controlling how verbose your output should be. # two versions for controlling how verbose your output should be.
macro(dbg_msg _MSG) macro(dbg_msg _MSG)
# message(STATUS "${_MSG}") # message(STATUS "${_MSG}")
endmacro(dbg_msg) endmacro()
macro(dbg_msg_v _MSG) macro(dbg_msg_v _MSG)
# message(STATUS "${_MSG}") # message(STATUS "${_MSG}")
endmacro(dbg_msg_v) endmacro()
# Clear return values in case the module is loaded more than once. # Clear return values in case the module is loaded more than once.
set(wxWidgets_FOUND FALSE) set(wxWidgets_FOUND FALSE)
@ -171,7 +171,7 @@ set(wxWidgets_CXX_FLAGS "")
# - else set wxWidgets_FIND_COMPONENTS to wxWidgets_USE_LIBS # - else set wxWidgets_FIND_COMPONENTS to wxWidgets_USE_LIBS
if(wxWidgets_USE_LIBS AND NOT wxWidgets_FIND_COMPONENTS) if(wxWidgets_USE_LIBS AND NOT wxWidgets_FIND_COMPONENTS)
set(wxWidgets_FIND_COMPONENTS ${wxWidgets_USE_LIBS}) set(wxWidgets_FIND_COMPONENTS ${wxWidgets_USE_LIBS})
endif(wxWidgets_USE_LIBS AND NOT wxWidgets_FIND_COMPONENTS) endif()
dbg_msg("wxWidgets_FIND_COMPONENTS : ${wxWidgets_FIND_COMPONENTS}") dbg_msg("wxWidgets_FIND_COMPONENTS : ${wxWidgets_FIND_COMPONENTS}")
# Add the convenience use file if available. # Add the convenience use file if available.
@ -187,9 +187,9 @@ get_filename_component(
if(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") if(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake")
set(wxWidgets_USE_FILE set(wxWidgets_USE_FILE
"${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake")
else(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") else()
set(wxWidgets_USE_FILE UsewxWidgets) set(wxWidgets_USE_FILE UsewxWidgets)
endif(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake") endif()
#===================================================================== #=====================================================================
#===================================================================== #=====================================================================
@ -218,17 +218,17 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
if(NOT wxWidgets_FIND_COMPONENTS) if(NOT wxWidgets_FIND_COMPONENTS)
if(wxWidgets_USE_MONOLITHIC) if(wxWidgets_USE_MONOLITHIC)
set(wxWidgets_FIND_COMPONENTS mono) set(wxWidgets_FIND_COMPONENTS mono)
else(wxWidgets_USE_MONOLITHIC) else()
set(wxWidgets_FIND_COMPONENTS core base) # this is default set(wxWidgets_FIND_COMPONENTS core base) # this is default
endif(wxWidgets_USE_MONOLITHIC) endif()
endif(NOT wxWidgets_FIND_COMPONENTS) endif()
# Add the common (usually required libs) unless # Add the common (usually required libs) unless
# wxWidgets_EXCLUDE_COMMON_LIBRARIES has been set. # wxWidgets_EXCLUDE_COMMON_LIBRARIES has been set.
if(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES) if(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES)
list(APPEND wxWidgets_FIND_COMPONENTS list(APPEND wxWidgets_FIND_COMPONENTS
${wxWidgets_COMMON_LIBRARIES}) ${wxWidgets_COMMON_LIBRARIES})
endif(NOT wxWidgets_EXCLUDE_COMMON_LIBRARIES) endif()
#------------------------------------------------------------------- #-------------------------------------------------------------------
# WIN32: Helper MACROS # WIN32: Helper MACROS
@ -243,9 +243,9 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
string(REGEX REPLACE "msw.*(u)[d]*$" "u" ${_UCD} "${_CONFIGURATION}") string(REGEX REPLACE "msw.*(u)[d]*$" "u" ${_UCD} "${_CONFIGURATION}")
if(${_UCD} STREQUAL ${_CONFIGURATION}) if(${_UCD} STREQUAL ${_CONFIGURATION})
set(${_UCD} "") set(${_UCD} "")
endif(${_UCD} STREQUAL ${_CONFIGURATION}) endif()
string(REGEX MATCH "d$" ${_DBG} "${_CONFIGURATION}") string(REGEX MATCH "d$" ${_DBG} "${_CONFIGURATION}")
endmacro(wx_get_name_components) endmacro()
# #
# Find libraries associated to a configuration. # Find libraries associated to a configuration.
@ -267,7 +267,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
mark_as_advanced(WX_${LIB}${_DBG}) mark_as_advanced(WX_${LIB}${_DBG})
endforeach(LIB) endforeach()
dbg_msg( "WX_LIB_DIR:${WX_LIB_DIR}" ) dbg_msg( "WX_LIB_DIR:${WX_LIB_DIR}" )
@ -299,7 +299,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
mark_as_advanced(WX_${LIB}${_DBG}) mark_as_advanced(WX_${LIB}${_DBG})
endforeach(LIB) endforeach()
# Find wxWidgets monolithic library. # Find wxWidgets monolithic library.
find_library(WX_mono${_DBG} find_library(WX_mono${_DBG}
@ -332,8 +332,8 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
mark_as_advanced(WX_${LIB}${_DBG}) mark_as_advanced(WX_${LIB}${_DBG})
endforeach(LIB) endforeach()
endmacro(wx_find_libs) endmacro()
# #
# Clear all library paths, so that FIND_LIBRARY refinds them. # Clear all library paths, so that FIND_LIBRARY refinds them.
@ -343,19 +343,19 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
set(${_LIB} "${_LIB}-NOTFOUND" CACHE FILEPATH "Cleared." FORCE) set(${_LIB} "${_LIB}-NOTFOUND" CACHE FILEPATH "Cleared." FORCE)
set(${_LIB}_FOUND FALSE) set(${_LIB}_FOUND FALSE)
mark_as_advanced(${_LIB}) mark_as_advanced(${_LIB})
endmacro(wx_clear_lib) endmacro()
# Clear all debug or release library paths (arguments are "d" or ""). # Clear all debug or release library paths (arguments are "d" or "").
macro(wx_clear_all_libs _DBG) macro(wx_clear_all_libs _DBG)
# Clear wxWidgets common libraries. # Clear wxWidgets common libraries.
foreach(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla) foreach(LIB ${wxWidgets_COMMON_LIBRARIES} scintilla)
wx_clear_lib(WX_${LIB}${_DBG}) wx_clear_lib(WX_${LIB}${_DBG})
endforeach(LIB) endforeach()
# Clear wxWidgets multilib base libraries. # Clear wxWidgets multilib base libraries.
wx_clear_lib(WX_base${_DBG}) wx_clear_lib(WX_base${_DBG})
foreach(LIB net odbc xml) foreach(LIB net odbc xml)
wx_clear_lib(WX_${LIB}${_DBG}) wx_clear_lib(WX_${LIB}${_DBG})
endforeach(LIB) endforeach()
# Clear wxWidgets monolithic library. # Clear wxWidgets monolithic library.
wx_clear_lib(WX_mono${_DBG}) wx_clear_lib(WX_mono${_DBG})
@ -364,16 +364,16 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
foreach(LIB core adv aui html media xrc dbgrid gl qa richtext foreach(LIB core adv aui html media xrc dbgrid gl qa richtext
webview stc ribbon propgrid) webview stc ribbon propgrid)
wx_clear_lib(WX_${LIB}${_DBG}) wx_clear_lib(WX_${LIB}${_DBG})
endforeach(LIB) endforeach()
endmacro(wx_clear_all_libs) endmacro()
# Clear all wxWidgets debug libraries. # Clear all wxWidgets debug libraries.
macro(wx_clear_all_dbg_libs) macro(wx_clear_all_dbg_libs)
wx_clear_all_libs("d") wx_clear_all_libs("d")
endmacro(wx_clear_all_dbg_libs) endmacro()
# Clear all wxWidgets release libraries. # Clear all wxWidgets release libraries.
macro(wx_clear_all_rel_libs) macro(wx_clear_all_rel_libs)
wx_clear_all_libs("") wx_clear_all_libs("")
endmacro(wx_clear_all_rel_libs) endmacro()
# #
# Set the wxWidgets_LIBRARIES variable. # Set the wxWidgets_LIBRARIES variable.
@ -391,35 +391,35 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
list(APPEND wxWidgets_LIBRARIES list(APPEND wxWidgets_LIBRARIES
debug ${WX_${LIB}d} optimized ${WX_${LIB}} debug ${WX_${LIB}d} optimized ${WX_${LIB}}
) )
else(WX_${LIB} AND WX_${LIB}d) else()
dbg_msg_v("- not found due to missing WX_${LIB}=${WX_${LIB}} or WX_${LIB}d=${WX_${LIB}d}") dbg_msg_v("- not found due to missing WX_${LIB}=${WX_${LIB}} or WX_${LIB}d=${WX_${LIB}d}")
set(wxWidgets_FOUND FALSE) set(wxWidgets_FOUND FALSE)
endif(WX_${LIB} AND WX_${LIB}d) endif()
endforeach(LIB) endforeach()
else(WX_USE_REL_AND_DBG) else()
foreach(LIB ${${_LIBS}}) foreach(LIB ${${_LIBS}})
dbg_msg_v("Searching for ${LIB}${_DBG}") dbg_msg_v("Searching for ${LIB}${_DBG}")
dbg_msg_v("WX_${LIB}${_DBG} : ${WX_${LIB}${_DBG}}") dbg_msg_v("WX_${LIB}${_DBG} : ${WX_${LIB}${_DBG}}")
if(WX_${LIB}${_DBG}) if(WX_${LIB}${_DBG})
dbg_msg_v("Found ${LIB}${_DBG}") dbg_msg_v("Found ${LIB}${_DBG}")
list(APPEND wxWidgets_LIBRARIES ${WX_${LIB}${_DBG}}) list(APPEND wxWidgets_LIBRARIES ${WX_${LIB}${_DBG}})
else(WX_${LIB}${_DBG}) else()
dbg_msg_v( dbg_msg_v(
"- not found due to missing WX_${LIB}${_DBG}=${WX_${LIB}${_DBG}}") "- not found due to missing WX_${LIB}${_DBG}=${WX_${LIB}${_DBG}}")
set(wxWidgets_FOUND FALSE) set(wxWidgets_FOUND FALSE)
endif(WX_${LIB}${_DBG}) endif()
endforeach(LIB) endforeach()
endif(WX_USE_REL_AND_DBG) endif()
dbg_msg_v("OpenGL") dbg_msg_v("OpenGL")
list(FIND ${_LIBS} gl WX_USE_GL) list(FIND ${_LIBS} gl WX_USE_GL)
if(NOT WX_USE_GL EQUAL -1) if(NOT WX_USE_GL EQUAL -1)
dbg_msg_v("- is required.") dbg_msg_v("- is required.")
list(APPEND wxWidgets_LIBRARIES opengl32 glu32) list(APPEND wxWidgets_LIBRARIES opengl32 glu32)
endif(NOT WX_USE_GL EQUAL -1) endif()
list(APPEND wxWidgets_LIBRARIES winmm comctl32 rpcrt4 wsock32) list(APPEND wxWidgets_LIBRARIES winmm comctl32 rpcrt4 wsock32)
endmacro(wx_set_libraries) endmacro()
#------------------------------------------------------------------- #-------------------------------------------------------------------
# WIN32: Start actual work. # WIN32: Start actual work.
@ -481,7 +481,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
CACHE INTERNAL "wxWidgets_ROOT_DIR") CACHE INTERNAL "wxWidgets_ROOT_DIR")
set(wxWidgets_LIB_DIR "wxWidgets_LIB_DIR-NOTFOUND" set(wxWidgets_LIB_DIR "wxWidgets_LIB_DIR-NOTFOUND"
CACHE PATH "Cleared." FORCE) CACHE PATH "Cleared." FORCE)
endif(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR) endif()
if(WX_ROOT_DIR) if(WX_ROOT_DIR)
dbg_msg( "WX_ROOT_DIR == wxWidgets_ROOT_DIR" ) dbg_msg( "WX_ROOT_DIR == wxWidgets_ROOT_DIR" )
@ -492,9 +492,9 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
if(MINGW) if(MINGW)
dbg_msg( "MINGW" ) dbg_msg( "MINGW" )
set(WX_LIB_DIR_PREFIX gcc) set(WX_LIB_DIR_PREFIX gcc)
else(MINGW) else()
set(WX_LIB_DIR_PREFIX vc) set(WX_LIB_DIR_PREFIX vc)
endif(MINGW) endif()
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
dbg_msg( "BUILD_SHARED_LIBS" ) dbg_msg( "BUILD_SHARED_LIBS" )
find_path(wxWidgets_LIB_DIR find_path(wxWidgets_LIB_DIR
@ -513,7 +513,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
DOC "Path to wxWidgets libraries?" DOC "Path to wxWidgets libraries?"
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
else(BUILD_SHARED_LIBS) else()
dbg_msg( "!BUILD_SHARED_LIBS WX_LIB_DIR:${WX_LIB_DIR}" ) dbg_msg( "!BUILD_SHARED_LIBS WX_LIB_DIR:${WX_LIB_DIR}" )
find_path(wxWidgets_LIB_DIR find_path(wxWidgets_LIB_DIR
NAMES NAMES
@ -531,21 +531,21 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
DOC "Path to wxWidgets libraries?" DOC "Path to wxWidgets libraries?"
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
endif(BUILD_SHARED_LIBS) endif()
# If wxWidgets_LIB_DIR changed, clear all libraries. # If wxWidgets_LIB_DIR changed, clear all libraries.
if(NOT WX_LIB_DIR STREQUAL wxWidgets_LIB_DIR) if(NOT WX_LIB_DIR STREQUAL wxWidgets_LIB_DIR)
set(WX_LIB_DIR ${wxWidgets_LIB_DIR} CACHE INTERNAL "wxWidgets_LIB_DIR") set(WX_LIB_DIR ${wxWidgets_LIB_DIR} CACHE INTERNAL "wxWidgets_LIB_DIR")
wx_clear_all_dbg_libs() wx_clear_all_dbg_libs()
wx_clear_all_rel_libs() wx_clear_all_rel_libs()
endif(NOT WX_LIB_DIR STREQUAL wxWidgets_LIB_DIR) endif()
if(WX_LIB_DIR) if(WX_LIB_DIR)
# If building shared libs, define WXUSINGDLL to use dllimport. # If building shared libs, define WXUSINGDLL to use dllimport.
if(WX_LIB_DIR MATCHES ".*[dD][lL][lL].*") if(WX_LIB_DIR MATCHES ".*[dD][lL][lL].*")
set(wxWidgets_DEFINITIONS WXUSINGDLL) set(wxWidgets_DEFINITIONS WXUSINGDLL)
dbg_msg_v("detected SHARED/DLL tree WX_LIB_DIR=${WX_LIB_DIR}") dbg_msg_v("detected SHARED/DLL tree WX_LIB_DIR=${WX_LIB_DIR}")
endif(WX_LIB_DIR MATCHES ".*[dD][lL][lL].*") endif()
# Search for available configuration types. # Search for available configuration types.
foreach(CFG mswunivud mswunivd mswud mswd mswunivu mswuniv mswu msw) foreach(CFG mswunivud mswunivd mswud mswd mswunivu mswuniv mswu msw)
@ -554,8 +554,8 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
list(APPEND WX_CONFIGURATION_LIST ${CFG}) list(APPEND WX_CONFIGURATION_LIST ${CFG})
set(WX_${CFG}_FOUND TRUE) set(WX_${CFG}_FOUND TRUE)
set(WX_CONFIGURATION ${CFG}) set(WX_CONFIGURATION ${CFG})
endif(EXISTS ${WX_LIB_DIR}/${CFG}) endif()
endforeach(CFG) endforeach()
dbg_msg_v("WX_CONFIGURATION_LIST=${WX_CONFIGURATION_LIST}") dbg_msg_v("WX_CONFIGURATION_LIST=${WX_CONFIGURATION_LIST}")
if(WX_CONFIGURATION) if(WX_CONFIGURATION)
@ -568,24 +568,24 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
if(NOT WX_${wxWidgets_CONFIGURATION}_FOUND) if(NOT WX_${wxWidgets_CONFIGURATION}_FOUND)
set(wxWidgets_CONFIGURATION ${WX_CONFIGURATION} CACHE STRING set(wxWidgets_CONFIGURATION ${WX_CONFIGURATION} CACHE STRING
"Set wxWidgets configuration (${WX_CONFIGURATION_LIST})" FORCE) "Set wxWidgets configuration (${WX_CONFIGURATION_LIST})" FORCE)
else(NOT WX_${wxWidgets_CONFIGURATION}_FOUND) else()
set(wxWidgets_CONFIGURATION ${wxWidgets_CONFIGURATION} CACHE STRING set(wxWidgets_CONFIGURATION ${wxWidgets_CONFIGURATION} CACHE STRING
"Set wxWidgets configuration (${WX_CONFIGURATION_LIST})" FORCE) "Set wxWidgets configuration (${WX_CONFIGURATION_LIST})" FORCE)
endif(NOT WX_${wxWidgets_CONFIGURATION}_FOUND) endif()
# If release config selected, and both release/debug exist. # If release config selected, and both release/debug exist.
if(WX_${wxWidgets_CONFIGURATION}d_FOUND) if(WX_${wxWidgets_CONFIGURATION}d_FOUND)
OPTION(wxWidgets_USE_REL_AND_DBG OPTION(wxWidgets_USE_REL_AND_DBG
"Use release and debug configurations?" TRUE) "Use release and debug configurations?" TRUE)
set(WX_USE_REL_AND_DBG ${wxWidgets_USE_REL_AND_DBG}) set(WX_USE_REL_AND_DBG ${wxWidgets_USE_REL_AND_DBG})
else(WX_${wxWidgets_CONFIGURATION}d_FOUND) else()
# If the option exists (already in cache), force it false. # If the option exists (already in cache), force it false.
if(wxWidgets_USE_REL_AND_DBG) if(wxWidgets_USE_REL_AND_DBG)
set(wxWidgets_USE_REL_AND_DBG FALSE CACHE BOOL set(wxWidgets_USE_REL_AND_DBG FALSE CACHE BOOL
"No ${wxWidgets_CONFIGURATION}d found." FORCE) "No ${wxWidgets_CONFIGURATION}d found." FORCE)
endif(wxWidgets_USE_REL_AND_DBG) endif()
set(WX_USE_REL_AND_DBG FALSE) set(WX_USE_REL_AND_DBG FALSE)
endif(WX_${wxWidgets_CONFIGURATION}d_FOUND) endif()
# Get configuration parameters from the name. # Get configuration parameters from the name.
wx_get_name_components(${wxWidgets_CONFIGURATION} UNV UCD DBG) wx_get_name_components(${wxWidgets_CONFIGURATION} UNV UCD DBG)
@ -594,24 +594,24 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
if(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h) if(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h)
set(wxWidgets_INCLUDE_DIRS set(wxWidgets_INCLUDE_DIRS
${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}) ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION})
else(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h) else()
dbg_msg("wxWidgets_FOUND FALSE because ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h does not exists.") dbg_msg("wxWidgets_FOUND FALSE because ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h does not exists.")
set(wxWidgets_FOUND FALSE) set(wxWidgets_FOUND FALSE)
endif(EXISTS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h) endif()
# Set wxWidgets main include directory. # Set wxWidgets main include directory.
if(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) if(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h)
list(APPEND wxWidgets_INCLUDE_DIRS ${WX_ROOT_DIR}/include) list(APPEND wxWidgets_INCLUDE_DIRS ${WX_ROOT_DIR}/include)
else(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) else()
dbg_msg("wxWidgets_FOUND FALSE because WX_ROOT_DIR=${WX_ROOT_DIR} has no ${WX_ROOT_DIR}/include/wx/wx.h") dbg_msg("wxWidgets_FOUND FALSE because WX_ROOT_DIR=${WX_ROOT_DIR} has no ${WX_ROOT_DIR}/include/wx/wx.h")
set(wxWidgets_FOUND FALSE) set(wxWidgets_FOUND FALSE)
endif(EXISTS ${WX_ROOT_DIR}/include/wx/wx.h) endif()
# Find wxWidgets libraries. # Find wxWidgets libraries.
wx_find_libs("${UNV}" "${UCD}" "${DBG}") wx_find_libs("${UNV}" "${UCD}" "${DBG}")
if(WX_USE_REL_AND_DBG) if(WX_USE_REL_AND_DBG)
wx_find_libs("${UNV}" "${UCD}" "d") wx_find_libs("${UNV}" "${UCD}" "d")
endif(WX_USE_REL_AND_DBG) endif()
# Settings for requested libs (i.e., include dir, libraries, etc.). # Settings for requested libs (i.e., include dir, libraries, etc.).
wx_set_libraries(wxWidgets_FIND_COMPONENTS "${DBG}") wx_set_libraries(wxWidgets_FIND_COMPONENTS "${DBG}")
@ -619,19 +619,19 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Add necessary definitions for unicode builds # Add necessary definitions for unicode builds
if("${UCD}" STREQUAL "u") if("${UCD}" STREQUAL "u")
list(APPEND wxWidgets_DEFINITIONS UNICODE _UNICODE) list(APPEND wxWidgets_DEFINITIONS UNICODE _UNICODE)
endif("${UCD}" STREQUAL "u") endif()
# Add necessary definitions for debug builds # Add necessary definitions for debug builds
set(wxWidgets_DEFINITIONS_DEBUG _DEBUG __WXDEBUG__) set(wxWidgets_DEFINITIONS_DEBUG _DEBUG __WXDEBUG__)
endif(WX_CONFIGURATION) endif()
endif(WX_LIB_DIR) endif()
endif(WX_ROOT_DIR) endif()
#===================================================================== #=====================================================================
# UNIX_FIND_STYLE # UNIX_FIND_STYLE
#===================================================================== #=====================================================================
else(wxWidgets_FIND_STYLE STREQUAL "win32") else()
dbg_msg("NOT win32 path") dbg_msg("NOT win32 path")
if(wxWidgets_FIND_STYLE STREQUAL "unix") if(wxWidgets_FIND_STYLE STREQUAL "unix")
@ -656,16 +656,16 @@ else(wxWidgets_FIND_STYLE STREQUAL "win32")
string(TOUPPER ${_opt_name} _upper_opt_name) string(TOUPPER ${_opt_name} _upper_opt_name)
if(_wx_selected_config MATCHES ".*${_opt_name}.*") if(_wx_selected_config MATCHES ".*${_opt_name}.*")
set(wxWidgets_DEFAULT_${_upper_opt_name} ON) set(wxWidgets_DEFAULT_${_upper_opt_name} ON)
else(_wx_selected_config MATCHES ".*${_opt_name}.*") else()
set(wxWidgets_DEFAULT_${_upper_opt_name} OFF) set(wxWidgets_DEFAULT_${_upper_opt_name} OFF)
endif(_wx_selected_config MATCHES ".*${_opt_name}.*") endif()
endforeach(_opt_name) endforeach()
else(_wx_result EQUAL 0) else()
foreach(_upper_opt_name DEBUG STATIC UNICODE UNIVERSAL) foreach(_upper_opt_name DEBUG STATIC UNICODE UNIVERSAL)
set(wxWidgets_DEFAULT_${_upper_opt_name} OFF) set(wxWidgets_DEFAULT_${_upper_opt_name} OFF)
endforeach(_upper_opt_name) endforeach()
endif(_wx_result EQUAL 0) endif()
endmacro(wx_config_select_get_default) endmacro()
# #
# Query a boolean configuration option to determine if the system # Query a boolean configuration option to determine if the system
@ -691,17 +691,17 @@ else(wxWidgets_FIND_STYLE STREQUAL "win32")
if(_wx_result_yes EQUAL 0 AND _wx_result_no EQUAL 0) if(_wx_result_yes EQUAL 0 AND _wx_result_no EQUAL 0)
OPTION(wxWidgets_USE_${_UPPER_OPT_NAME} OPTION(wxWidgets_USE_${_UPPER_OPT_NAME}
${_OPT_HELP} ${wxWidgets_DEFAULT_${_UPPER_OPT_NAME}}) ${_OPT_HELP} ${wxWidgets_DEFAULT_${_UPPER_OPT_NAME}})
else(_wx_result_yes EQUAL 0 AND _wx_result_no EQUAL 0) else()
# If option exists (already in cache), force to available one. # If option exists (already in cache), force to available one.
if(DEFINED wxWidgets_USE_${_UPPER_OPT_NAME}) if(DEFINED wxWidgets_USE_${_UPPER_OPT_NAME})
if(_wx_result_yes EQUAL 0) if(_wx_result_yes EQUAL 0)
set(wxWidgets_USE_${_UPPER_OPT_NAME} ON CACHE BOOL ${_OPT_HELP} FORCE) set(wxWidgets_USE_${_UPPER_OPT_NAME} ON CACHE BOOL ${_OPT_HELP} FORCE)
else(_wx_result_yes EQUAL 0) else()
set(wxWidgets_USE_${_UPPER_OPT_NAME} OFF CACHE BOOL ${_OPT_HELP} FORCE) set(wxWidgets_USE_${_UPPER_OPT_NAME} OFF CACHE BOOL ${_OPT_HELP} FORCE)
endif(_wx_result_yes EQUAL 0) endif()
endif(DEFINED wxWidgets_USE_${_UPPER_OPT_NAME}) endif()
endif(_wx_result_yes EQUAL 0 AND _wx_result_no EQUAL 0) endif()
endmacro(wx_config_select_query_bool) endmacro()
# #
# Set wxWidgets_SELECT_OPTIONS to wx-config options for selecting # Set wxWidgets_SELECT_OPTIONS to wx-config options for selecting
@ -714,12 +714,12 @@ else(wxWidgets_FIND_STYLE STREQUAL "win32")
if(DEFINED wxWidgets_USE_${_upper_opt_name}) if(DEFINED wxWidgets_USE_${_upper_opt_name})
if(wxWidgets_USE_${_upper_opt_name}) if(wxWidgets_USE_${_upper_opt_name})
list(APPEND wxWidgets_SELECT_OPTIONS --${_opt_name}=yes) list(APPEND wxWidgets_SELECT_OPTIONS --${_opt_name}=yes)
else(wxWidgets_USE_${_upper_opt_name}) else()
list(APPEND wxWidgets_SELECT_OPTIONS --${_opt_name}=no) list(APPEND wxWidgets_SELECT_OPTIONS --${_opt_name}=no)
endif(wxWidgets_USE_${_upper_opt_name}) endif()
endif(DEFINED wxWidgets_USE_${_upper_opt_name}) endif()
endforeach(_opt_name) endforeach()
endmacro(wx_config_select_set_options) endmacro()
#----------------------------------------------------------------- #-----------------------------------------------------------------
# UNIX: Start actual work. # UNIX: Start actual work.
@ -786,10 +786,10 @@ else(wxWidgets_FIND_STYLE STREQUAL "win32")
dbg_msg_v("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}") dbg_msg_v("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}")
dbg_msg_v("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}") dbg_msg_v("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
else(RET EQUAL 0) else()
set(wxWidgets_FOUND FALSE) set(wxWidgets_FOUND FALSE)
dbg_msg_v("${wxWidgets_CONFIG_EXECUTABLE} --cxxflags FAILED with RET=${RET}") dbg_msg_v("${wxWidgets_CONFIG_EXECUTABLE} --cxxflags FAILED with RET=${RET}")
endif(RET EQUAL 0) endif()
# run the wx-config program to get the libs # run the wx-config program to get the libs
# - NOTE: wx-config doesn't verify that the libs requested exist # - NOTE: wx-config doesn't verify that the libs requested exist
@ -823,11 +823,10 @@ else(wxWidgets_FIND_STYLE STREQUAL "win32")
dbg_msg_v("wxWidgets_LIBRARIES=${wxWidgets_LIBRARIES}") dbg_msg_v("wxWidgets_LIBRARIES=${wxWidgets_LIBRARIES}")
dbg_msg_v("wxWidgets_LIBRARY_DIRS=${wxWidgets_LIBRARY_DIRS}") dbg_msg_v("wxWidgets_LIBRARY_DIRS=${wxWidgets_LIBRARY_DIRS}")
else(RET EQUAL 0) else()
set(wxWidgets_FOUND FALSE) set(wxWidgets_FOUND FALSE)
dbg_msg("${wxWidgets_CONFIG_EXECUTABLE} --libs ${wxWidgets_FIND_COMPONENTS} FAILED with RET=${RET}") endif()
endif(RET EQUAL 0) endif()
endif(wxWidgets_CONFIG_EXECUTABLE)
# When using wx-config in MSYS, the include paths are UNIX style paths which may or may # When using wx-config in MSYS, the include paths are UNIX style paths which may or may
# not work correctly depending on you MSYS/MinGW configuration. CMake expects native # not work correctly depending on you MSYS/MinGW configuration. CMake expects native
@ -860,17 +859,16 @@ else(wxWidgets_FIND_STYLE STREQUAL "win32")
#===================================================================== #=====================================================================
# Neither UNIX_FIND_STYLE, nor WIN32_FIND_STYLE # Neither UNIX_FIND_STYLE, nor WIN32_FIND_STYLE
#===================================================================== #=====================================================================
else(wxWidgets_FIND_STYLE STREQUAL "unix") else()
if(NOT wxWidgets_FIND_QUIETLY) if(NOT wxWidgets_FIND_QUIETLY)
message(STATUS message(STATUS
"${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): \n" "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): \n"
" Platform unknown/unsupported. It's neither WIN32 nor UNIX " " Platform unknown/unsupported. It's neither WIN32 nor UNIX "
"find style." "find style."
) )
endif(NOT wxWidgets_FIND_QUIETLY) endif()
endif(wxWidgets_FIND_STYLE STREQUAL "unix") endif()
endif(wxWidgets_FIND_STYLE STREQUAL "win32") endif()
# Check if a specfic version was requested by find_package(). # Check if a specfic version was requested by find_package().
if(wxWidgets_FOUND AND wxWidgets_FIND_VERSION) if(wxWidgets_FOUND AND wxWidgets_FIND_VERSION)
@ -944,7 +942,7 @@ find_program(wxWidgets_wxrc_EXECUTABLE wxrc
# function(wxwidgets_add_resources outfiles) # function(wxwidgets_add_resources outfiles)
# wx_split_arguments_on(OPTIONS wxrc_files wxrc_options ${ARGN}) # wx_split_arguments_on(OPTIONS wxrc_files wxrc_options ${ARGN})
# ... # ...
# endfunction(wxwidgets_add_resources) # endfunction()
# #
# wxwidgets_add_resources(sources ${xrc_files} OPTIONS -e -o file.C) # wxwidgets_add_resources(sources ${xrc_files} OPTIONS -e -o file.C)
# #
@ -966,18 +964,18 @@ function(wx_split_arguments_on _keyword _leftvar _rightvar)
foreach(element ${ARGN}) foreach(element ${ARGN})
if("${element}" STREQUAL "${_keyword}") if("${element}" STREQUAL "${_keyword}")
set(_doing_right TRUE) set(_doing_right TRUE)
else("${element}" STREQUAL "${_keyword}") else()
if(_doing_right) if(_doing_right)
list(APPEND ${_rightvar} "${element}") list(APPEND ${_rightvar} "${element}")
else(_doing_right) else()
list(APPEND ${_leftvar} "${element}") list(APPEND ${_leftvar} "${element}")
endif(_doing_right) endif()
endif("${element}" STREQUAL "${_keyword}") endif()
endforeach(element) endforeach()
set(${_leftvar} ${${_leftvar}} PARENT_SCOPE) set(${_leftvar} ${${_leftvar}} PARENT_SCOPE)
set(${_rightvar} ${${_rightvar}} PARENT_SCOPE) set(${_rightvar} ${${_rightvar}} PARENT_SCOPE)
endfunction(wx_split_arguments_on) endfunction()
# #
# wx_get_dependencies_from_xml( # wx_get_dependencies_from_xml(
@ -1009,14 +1007,14 @@ function(wx_get_dependencies_from_xml
# make the file have an absolute path # make the file have an absolute path
if(NOT IS_ABSOLUTE "${dep_file}") if(NOT IS_ABSOLUTE "${dep_file}")
set(dep_file "${${_depends_path}}/${dep_file}") set(dep_file "${${_depends_path}}/${dep_file}")
endif(NOT IS_ABSOLUTE "${dep_file}") endif()
# append file to dependency list # append file to dependency list
list(APPEND ${_depends} "${dep_file}") list(APPEND ${_depends} "${dep_file}")
endforeach(dep_file) endforeach()
set(${_depends} ${${_depends}} PARENT_SCOPE) set(${_depends} ${${_depends}} PARENT_SCOPE)
endfunction(wx_get_dependencies_from_xml) endfunction()
# #
# wxwidgets_add_resources(<sources> <xrc_files> # wxwidgets_add_resources(<sources> <xrc_files>
@ -1071,7 +1069,7 @@ function(wxwidgets_add_resources _outfiles)
rc_file_contents rc_file_contents
depends_path depends_path
) )
endforeach(rc_file) endforeach()
# #
# Parse options. # Parse options.
@ -1083,11 +1081,11 @@ function(wxwidgets_add_resources _outfiles)
list(APPEND rc_options --cpp-code) list(APPEND rc_options --cpp-code)
# wxrc's default output filename for cpp code. # wxrc's default output filename for cpp code.
set(outfile resource.cpp) set(outfile resource.cpp)
else(index EQUAL -1) else()
list(REMOVE_AT rc_options ${index}) list(REMOVE_AT rc_options ${index})
# wxrc's default output filename for xrs file. # wxrc's default output filename for xrs file.
set(outfile resource.xrs) set(outfile resource.xrs)
endif(index EQUAL -1) endif()
# Get output name for use in add_custom_command. # Get output name for use in add_custom_command.
# - short option scanning # - short option scanning
@ -1096,18 +1094,18 @@ function(wxwidgets_add_resources _outfiles)
MATH(EXPR filename_index "${index} + 1") MATH(EXPR filename_index "${index} + 1")
list(GET rc_options ${filename_index} outfile) list(GET rc_options ${filename_index} outfile)
#list(REMOVE_AT rc_options ${index} ${filename_index}) #list(REMOVE_AT rc_options ${index} ${filename_index})
endif(NOT index EQUAL -1) endif()
# - long option scanning # - long option scanning
string(REGEX MATCH "--output=[^;]*" outfile_opt "${rc_options}") string(REGEX MATCH "--output=[^;]*" outfile_opt "${rc_options}")
if(outfile_opt) if(outfile_opt)
string(REPLACE "--output=" "" outfile "${outfile_opt}") string(REPLACE "--output=" "" outfile "${outfile_opt}")
endif(outfile_opt) endif()
#string(REGEX REPLACE "--output=[^;]*;?" "" rc_options "${rc_options}") #string(REGEX REPLACE "--output=[^;]*;?" "" rc_options "${rc_options}")
#string(REGEX REPLACE ";$" "" rc_options "${rc_options}") #string(REGEX REPLACE ";$" "" rc_options "${rc_options}")
if(NOT IS_ABSOLUTE "${outfile}") if(NOT IS_ABSOLUTE "${outfile}")
set(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") set(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}")
endif(NOT IS_ABSOLUTE "${outfile}") endif()
add_custom_command( add_custom_command(
OUTPUT "${outfile}" OUTPUT "${outfile}"
COMMAND ${wxWidgets_wxrc_EXECUTABLE} ${rc_options} ${rc_file_list_abs} COMMAND ${wxWidgets_wxrc_EXECUTABLE} ${rc_options} ${rc_file_list_abs}
@ -1124,10 +1122,10 @@ function(wxwidgets_add_resources _outfiles)
set_source_files_properties( set_source_files_properties(
"${outfile_header}" PROPERTIES GENERATED TRUE "${outfile_header}" PROPERTIES GENERATED TRUE
) )
endif(NOT short_index EQUAL -1 OR NOT long_index EQUAL -1) endif()
# Add generated file to output file list. # Add generated file to output file list.
list(APPEND ${_outfiles} "${outfile}") list(APPEND ${_outfiles} "${outfile}")
set(${_outfiles} ${${_outfiles}} PARENT_SCOPE) set(${_outfiles} ${${_outfiles}} PARENT_SCOPE)
endfunction(wxwidgets_add_resources) endfunction()