mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-03 21:00:01 -05:00
FindwxWidgets: honor OPTIONAL_COMPONENTS
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
# modules that you will use, you need to name them as components to the
|
# modules that you will use, you need to name them as components to the
|
||||||
# package:
|
# package:
|
||||||
#
|
#
|
||||||
# find_package(wxWidgets COMPONENTS core base ...)
|
# find_package(wxWidgets COMPONENTS core base ... OPTIONAL_COMPONENTS net ...)
|
||||||
#
|
#
|
||||||
# There are two search branches: a windows style and a unix style. For
|
# There are two search branches: a windows style and a unix style. For
|
||||||
# windows, the following variables are searched for and set to defaults
|
# windows, the following variables are searched for and set to defaults
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
# ::
|
# ::
|
||||||
#
|
#
|
||||||
# # Note that for MinGW users the order of libs is important!
|
# # Note that for MinGW users the order of libs is important!
|
||||||
# find_package(wxWidgets COMPONENTS net gl core base)
|
# find_package(wxWidgets COMPONENTS gl core base OPTIONAL_COMPONENTS net)
|
||||||
# if(wxWidgets_FOUND)
|
# if(wxWidgets_FOUND)
|
||||||
# include(${wxWidgets_USE_FILE})
|
# include(${wxWidgets_USE_FILE})
|
||||||
# # and for each of your dependent executable/library targets:
|
# # and for each of your dependent executable/library targets:
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
#
|
#
|
||||||
# ::
|
# ::
|
||||||
#
|
#
|
||||||
# find_package(wxWidgets REQUIRED net gl core base)
|
# find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net)
|
||||||
# include(${wxWidgets_USE_FILE})
|
# include(${wxWidgets_USE_FILE})
|
||||||
# # and for each of your dependent executable/library targets:
|
# # and for each of your dependent executable/library targets:
|
||||||
# target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
|
# target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
|
||||||
@@ -396,6 +396,8 @@ 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}}
|
||||||
)
|
)
|
||||||
|
elseif(NOT wxWidgets_FIND_REQUIRED_${LIB})
|
||||||
|
DBG_MSG_V("- ignored optional missing WX_${LIB}=${WX_${LIB}} or WX_${LIB}d=${WX_${LIB}d}")
|
||||||
else()
|
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)
|
||||||
@@ -408,9 +410,10 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
|
|||||||
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}})
|
||||||
|
elseif(NOT wxWidgets_FIND_REQUIRED_${LIB})
|
||||||
|
DBG_MSG_V("- ignored optional missing WX_${LIB}${_DBG}=${WX_${LIB}${_DBG}}")
|
||||||
else()
|
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()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
@@ -803,11 +806,24 @@ else()
|
|||||||
# - NOTE: wx-config doesn't verify that the libs requested exist
|
# - NOTE: wx-config doesn't verify that the libs requested exist
|
||||||
# it just produces the names. Maybe a TRY_COMPILE would
|
# it just produces the names. Maybe a TRY_COMPILE would
|
||||||
# be useful here...
|
# be useful here...
|
||||||
string(REPLACE ";" ","
|
unset(_cmp_req)
|
||||||
wxWidgets_FIND_COMPONENTS "${wxWidgets_FIND_COMPONENTS}")
|
unset(_cmp_opt)
|
||||||
|
foreach(_cmp IN LISTS wxWidgets_FIND_COMPONENTS)
|
||||||
|
if(wxWidgets_FIND_REQUIRED_${_cmp})
|
||||||
|
list(APPEND _cmp_req "${_cmp}")
|
||||||
|
else()
|
||||||
|
list(APPEND _cmp_opt "${_cmp}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
DBG_MSG_V("wxWidgets required components : ${_cmp_req}")
|
||||||
|
DBG_MSG_V("wxWidgets optional components : ${_cmp_opt}")
|
||||||
|
if(DEFINED _cmp_opt)
|
||||||
|
string(REPLACE ";" "," _cmp_opt "--optional-libs ${_cmp_opt}")
|
||||||
|
endif()
|
||||||
|
string(REPLACE ";" "," _cmp_req "${_cmp_req}")
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}"
|
COMMAND sh "${wxWidgets_CONFIG_EXECUTABLE}"
|
||||||
${wxWidgets_SELECT_OPTIONS} --libs ${wxWidgets_FIND_COMPONENTS}
|
${wxWidgets_SELECT_OPTIONS} --libs ${_cmp_req} ${_cmp_opt}
|
||||||
OUTPUT_VARIABLE wxWidgets_LIBRARIES
|
OUTPUT_VARIABLE wxWidgets_LIBRARIES
|
||||||
RESULT_VARIABLE RET
|
RESULT_VARIABLE RET
|
||||||
ERROR_QUIET
|
ERROR_QUIET
|
||||||
@@ -833,8 +849,10 @@ else()
|
|||||||
|
|
||||||
else()
|
else()
|
||||||
set(wxWidgets_FOUND FALSE)
|
set(wxWidgets_FOUND FALSE)
|
||||||
DBG_MSG("${wxWidgets_CONFIG_EXECUTABLE} --libs ${wxWidgets_FIND_COMPONENTS} FAILED with RET=${RET}")
|
DBG_MSG("${wxWidgets_CONFIG_EXECUTABLE} --libs ${_cmp_req} ${_cmp_opt} FAILED with RET=${RET}")
|
||||||
endif()
|
endif()
|
||||||
|
unset(_cmp_req)
|
||||||
|
unset(_cmp_opt)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# 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
|
||||||
|
|||||||
Reference in New Issue
Block a user