diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake index 56fc23ce77..d397f0dca2 100644 --- a/build/cmake/config.cmake +++ b/build/cmake/config.cmake @@ -27,6 +27,18 @@ macro(wx_configure_script input output) ) 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) wx_configure_script( "${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_NOGUI "wx_base${lib_unicode_suffix}") - set(WXCONFIG_LIBS) - set(EXTRALIBS_GUI) - set(EXTRALIBS_SDL) - set(EXTRALIBS_HTML) - set(EXTRALIBS_STC) - set(EXTRALIBS_WEBVIEW) - set(EXTRALIBS_XML) - set(EXTRALIBS_MEDIA) - set(OPENGL_LIBS) + wx_get_dependencies(WXCONFIG_LIBS base) + wx_get_dependencies(EXTRALIBS_GUI core) + set(EXTRALIBS_SDL) # included in core libs when SDL is enabled + wx_get_dependencies(EXTRALIBS_HTML html) + wx_get_dependencies(EXTRALIBS_STC stc) + wx_get_dependencies(EXTRALIBS_WEBVIEW webview) + wx_get_dependencies(EXTRALIBS_XML xml) + wx_get_dependencies(EXTRALIBS_MEDIA media) + wx_get_dependencies(OPENGL_LIBS gl) set(DMALLOC_LIBS) set(CC ${CMAKE_C_COMPILER}) set(CXX ${CMAKE_CXX_COMPILER}) set(WXCONFIG_CFLAGS) set(WXCONFIG_LDFLAGS) - set(WXCONFIG_CPPFLAGS) - set(WXCONFIG_CXXFLAGS) + if(CMAKE_USE_PTHREADS_INIT) + 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_RESFLAGS) - set(WXCONFIG_RPATH) + set(WXCONFIG_RPATH "-Wl,-rpath,\$libdir") set(LDFLAGS_GL) set(RESCOMP)