CMake: Only link executables to enabled libraries
This commit is contained in:
parent
76617ddb1e
commit
fb8403a064
@ -701,7 +701,7 @@ function(wx_add_test name)
|
||||
endif()
|
||||
add_executable(${name} ${test_src})
|
||||
target_include_directories(${name} PRIVATE "${wxSOURCE_DIR}/tests" "${wxSOURCE_DIR}/3rdparty/catch/include")
|
||||
wx_exe_link_libraries(${name} base net)
|
||||
wx_exe_link_libraries(${name} base)
|
||||
if(wxBUILD_SHARED)
|
||||
target_compile_definitions(${name} PRIVATE WXUSINGDLL)
|
||||
endif()
|
||||
|
@ -99,6 +99,9 @@ endif()
|
||||
|
||||
wx_add_test(test_base ${TEST_SRC})
|
||||
target_compile_definitions(test_base PRIVATE wxUSE_GUI=0 wxUSE_BASE=1)
|
||||
if(wxUSE_SOCKETS)
|
||||
wx_exe_link_libraries(test_base net)
|
||||
endif()
|
||||
if(wxUSE_XML)
|
||||
wx_exe_link_libraries(test_base xml)
|
||||
endif()
|
||||
|
@ -22,6 +22,9 @@ set(TEST_DRAWING_SRC
|
||||
drawing/fonttest.cpp
|
||||
)
|
||||
wx_add_test(test_drawing ${TEST_DRAWING_SRC})
|
||||
if(wxUSE_SOCKETS)
|
||||
wx_exe_link_libraries(test_drawing net)
|
||||
endif()
|
||||
wx_exe_link_libraries(test_drawing core)
|
||||
wx_test_enable_precomp(test_drawing)
|
||||
|
||||
|
@ -107,5 +107,27 @@ set(TEST_GUI_SRC
|
||||
xml/xrctest.cpp
|
||||
)
|
||||
wx_add_test(test_gui ${TEST_GUI_SRC})
|
||||
wx_exe_link_libraries(test_gui core richtext media xrc xml adv html net webview)
|
||||
wx_exe_link_libraries(test_gui core)
|
||||
if(wxUSE_RICHTEXT)
|
||||
wx_exe_link_libraries(test_gui richtext)
|
||||
endif()
|
||||
if(wxUSE_MEDIACTRL)
|
||||
wx_exe_link_libraries(test_gui media)
|
||||
endif()
|
||||
if(wxUSE_XRC)
|
||||
wx_exe_link_libraries(test_gui xrc)
|
||||
endif()
|
||||
if(wxUSE_XML)
|
||||
wx_exe_link_libraries(test_gui xml)
|
||||
endif()
|
||||
wx_exe_link_libraries(test_gui adv)
|
||||
if(wxUSE_HTML)
|
||||
wx_exe_link_libraries(test_gui html)
|
||||
endif()
|
||||
if(wxUSE_SOCKETS)
|
||||
wx_exe_link_libraries(test_gui net)
|
||||
endif()
|
||||
if(wxUSE_WEBVIEW)
|
||||
wx_exe_link_libraries(test_gui webview)
|
||||
endif()
|
||||
wx_test_enable_precomp(test_gui)
|
||||
|
@ -13,7 +13,10 @@ if(wxUSE_XRC)
|
||||
if(wxBUILD_SHARED)
|
||||
target_compile_definitions(wxrc PRIVATE WXUSINGDLL)
|
||||
endif()
|
||||
wx_exe_link_libraries(wxrc xml base)
|
||||
if(wxUSE_XML)
|
||||
wx_exe_link_libraries(wxrc xml)
|
||||
endif()
|
||||
wx_exe_link_libraries(wxrc base)
|
||||
# TODO: install
|
||||
set_target_properties(wxrc PROPERTIES FOLDER "Utilities")
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user