CMake: Set wx-config extra libraries and flags

This commit is contained in:
Maarten Bent 2018-12-06 22:38:33 +01:00
parent 12ed604cb3
commit c28ae123c1

View File

@ -27,6 +27,18 @@ macro(wx_configure_script input output)
) )
endmacro() endmacro()
macro(wx_get_dependencies var lib)
set(${var})
if(TARGET ${lib})
get_target_property(deps ${lib} LINK_LIBRARIES)
foreach(dep IN LISTS deps)
get_filename_component(name ${dep} NAME)
wx_string_append(${var} "${name} ")
endforeach()
string(STRIP ${${var}} ${var})
endif()
endmacro()
function(wx_write_config_inplace) function(wx_write_config_inplace)
wx_configure_script( wx_configure_script(
"${CMAKE_CURRENT_SOURCE_DIR}/wx-config-inplace.in" "${CMAKE_CURRENT_SOURCE_DIR}/wx-config-inplace.in"
@ -108,26 +120,33 @@ function(wx_write_config)
set(WX_LIBRARY_BASENAME_GUI "wx_${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}") set(WX_LIBRARY_BASENAME_GUI "wx_${TOOLKIT_DIR}${TOOLKIT_VERSION}${WIDGET_SET}${lib_unicode_suffix}")
set(WX_LIBRARY_BASENAME_NOGUI "wx_base${lib_unicode_suffix}") set(WX_LIBRARY_BASENAME_NOGUI "wx_base${lib_unicode_suffix}")
set(WXCONFIG_LIBS) wx_get_dependencies(WXCONFIG_LIBS base)
set(EXTRALIBS_GUI) wx_get_dependencies(EXTRALIBS_GUI core)
set(EXTRALIBS_SDL) set(EXTRALIBS_SDL) # included in core libs when SDL is enabled
set(EXTRALIBS_HTML) wx_get_dependencies(EXTRALIBS_HTML html)
set(EXTRALIBS_STC) wx_get_dependencies(EXTRALIBS_STC stc)
set(EXTRALIBS_WEBVIEW) wx_get_dependencies(EXTRALIBS_WEBVIEW webview)
set(EXTRALIBS_XML) wx_get_dependencies(EXTRALIBS_XML xml)
set(EXTRALIBS_MEDIA) wx_get_dependencies(EXTRALIBS_MEDIA media)
set(OPENGL_LIBS) wx_get_dependencies(OPENGL_LIBS gl)
set(DMALLOC_LIBS) set(DMALLOC_LIBS)
set(CC ${CMAKE_C_COMPILER}) set(CC ${CMAKE_C_COMPILER})
set(CXX ${CMAKE_CXX_COMPILER}) set(CXX ${CMAKE_CXX_COMPILER})
set(WXCONFIG_CFLAGS) set(WXCONFIG_CFLAGS)
set(WXCONFIG_LDFLAGS) set(WXCONFIG_LDFLAGS)
set(WXCONFIG_CPPFLAGS) if(CMAKE_USE_PTHREADS_INIT)
set(WXCONFIG_CXXFLAGS) set(WXCONFIG_CFLAGS "-pthread")
set(WXCONFIG_LDFLAGS "-pthread")
endif()
set(WXCONFIG_CPPFLAGS "-DWXUSINGDLL")
foreach(flag IN LISTS wxTOOLKIT_DEFINITIONS)
wx_string_append(WXCONFIG_CPPFLAGS " -D${flag}")
endforeach()
set(WXCONFIG_CXXFLAGS ${WXCONFIG_CFLAGS})
set(WXCONFIG_LDFLAGS_GUI) set(WXCONFIG_LDFLAGS_GUI)
set(WXCONFIG_RESFLAGS) set(WXCONFIG_RESFLAGS)
set(WXCONFIG_RPATH) set(WXCONFIG_RPATH "-Wl,-rpath,\$libdir")
set(LDFLAGS_GL) set(LDFLAGS_GL)
set(RESCOMP) set(RESCOMP)