CMake: Fix monolithic build

Don't target net and webview libraries directly, but use the wx_ function that will add it to the mono library when applicable.
This commit is contained in:
Maarten Bent 2022-04-09 17:23:26 +02:00
parent 0125a52376
commit f00e7ced27
4 changed files with 18 additions and 2 deletions

View file

@ -513,6 +513,18 @@ macro(wx_lib_compile_definitions name)
endif()
endmacro()
# wx_add_dependencies(name dep)
# Forwards everything to add_dependencies() except for monolithic
# build where it collects all dependencies for linking with the mono lib
macro(wx_add_dependencies name)
if(wxBUILD_MONOLITHIC)
list(APPEND wxMONO_DEPENDENCIES ${ARGN})
set(wxMONO_DEPENDENCIES ${wxMONO_DEPENDENCIES} PARENT_SCOPE)
else()
add_dependencies(${name} ${ARGN})
endif()
endmacro()
# Set common properties for a builtin third party library
function(wx_set_builtin_target_properties target_name)
set(lib_unicode)

View file

@ -17,6 +17,7 @@ if(wxBUILD_MONOLITHIC)
set(wxMONO_INCLUDE_DIRS)
set(wxMONO_DEFINITIONS)
set(wxMONO_NONCOMPILED_CPP_FILES)
set(wxMONO_DEPENDENCIES)
endif()
# Define third party libraries
@ -95,6 +96,9 @@ if(wxBUILD_MONOLITHIC)
foreach(file ${wxMONO_NONCOMPILED_CPP_FILES})
set_source_files_properties(${file} PROPERTIES HEADER_FILE_ONLY TRUE)
endforeach()
foreach(dep ${wxMONO_DEPENDENCIES})
add_dependencies(wxmono ${dep})
endforeach()
wx_webview_copy_webview2_loader(wxmono)
endif()

View file

@ -32,6 +32,6 @@ if(WIN32)
endif()
if (wxUSE_WEBREQUEST_CURL)
target_include_directories(wxnet PRIVATE ${CURL_INCLUDE_DIRS})
wx_lib_include_directories(wxnet ${CURL_INCLUDE_DIRS})
wx_lib_link_libraries(wxnet PRIVATE ${CURL_LIBRARIES})
endif()

View file

@ -152,5 +152,5 @@ if(WXGTK AND wxUSE_WEBVIEW_WEBKIT2)
wx_install(TARGETS wxwebkit2_ext LIBRARY DESTINATION "lib/wx/${WX_WEB_EXT_VERSION}/web-extensions")
add_dependencies(wxwebview wxwebkit2_ext)
wx_add_dependencies(wxwebview wxwebkit2_ext)
endif()