CMake: Only link executables to enabled libraries
This commit is contained in:
@@ -701,7 +701,7 @@ function(wx_add_test name)
|
|||||||
endif()
|
endif()
|
||||||
add_executable(${name} ${test_src})
|
add_executable(${name} ${test_src})
|
||||||
target_include_directories(${name} PRIVATE "${wxSOURCE_DIR}/tests" "${wxSOURCE_DIR}/3rdparty/catch/include")
|
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)
|
if(wxBUILD_SHARED)
|
||||||
target_compile_definitions(${name} PRIVATE WXUSINGDLL)
|
target_compile_definitions(${name} PRIVATE WXUSINGDLL)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -99,6 +99,9 @@ endif()
|
|||||||
|
|
||||||
wx_add_test(test_base ${TEST_SRC})
|
wx_add_test(test_base ${TEST_SRC})
|
||||||
target_compile_definitions(test_base PRIVATE wxUSE_GUI=0 wxUSE_BASE=1)
|
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)
|
if(wxUSE_XML)
|
||||||
wx_exe_link_libraries(test_base xml)
|
wx_exe_link_libraries(test_base xml)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -22,6 +22,9 @@ set(TEST_DRAWING_SRC
|
|||||||
drawing/fonttest.cpp
|
drawing/fonttest.cpp
|
||||||
)
|
)
|
||||||
wx_add_test(test_drawing ${TEST_DRAWING_SRC})
|
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_exe_link_libraries(test_drawing core)
|
||||||
wx_test_enable_precomp(test_drawing)
|
wx_test_enable_precomp(test_drawing)
|
||||||
|
|
||||||
|
@@ -107,5 +107,27 @@ set(TEST_GUI_SRC
|
|||||||
xml/xrctest.cpp
|
xml/xrctest.cpp
|
||||||
)
|
)
|
||||||
wx_add_test(test_gui ${TEST_GUI_SRC})
|
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)
|
wx_test_enable_precomp(test_gui)
|
||||||
|
@@ -13,7 +13,10 @@ if(wxUSE_XRC)
|
|||||||
if(wxBUILD_SHARED)
|
if(wxBUILD_SHARED)
|
||||||
target_compile_definitions(wxrc PRIVATE WXUSINGDLL)
|
target_compile_definitions(wxrc PRIVATE WXUSINGDLL)
|
||||||
endif()
|
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
|
# TODO: install
|
||||||
set_target_properties(wxrc PROPERTIES FOLDER "Utilities")
|
set_target_properties(wxrc PROPERTIES FOLDER "Utilities")
|
||||||
endif()
|
endif()
|
||||||
|
Reference in New Issue
Block a user