CMake: Add argument to specify console app that uses gui libraries

This commit is contained in:
Maarten Bent
2021-02-07 20:11:56 +01:00
parent 414f211b8a
commit 7b79423470
4 changed files with 7 additions and 6 deletions

View File

@@ -606,12 +606,13 @@ function(wx_print_thirdparty_library_summary)
endfunction() endfunction()
# Add sample, test or demo # Add sample, test or demo
# wx_add(<name> <group> [CONSOLE|DLL] [IMPORTANT] [SRC_FILES...] # wx_add(<name> <group> [CONSOLE|CONSOLE_GUI|DLL] [IMPORTANT] [SRC_FILES...]
# [LIBRARIES ...] [NAME target_name] [FOLDER folder] # [LIBRARIES ...] [NAME target_name] [FOLDER folder]
# [DATA ...] [DEFINITIONS ...] [RES ...]) # [DATA ...] [DEFINITIONS ...] [RES ...])
# name default target name # name default target name
# group can be Samples, Tests or Demos # group can be Samples, Tests or Demos
# first parameter may be CONSOLE to indicate a console application or DLL to indicate a shared library # first parameter may be CONSOLE to indicate a console application or DLL to indicate a shared library
# or CONSOLE_GUI to indicate a console application that uses gui libraries
# all following parameters are src files for the executable # all following parameters are src files for the executable
# #
# Optionally: # Optionally:
@@ -641,7 +642,7 @@ endfunction()
function(wx_add name group) function(wx_add name group)
cmake_parse_arguments(APP cmake_parse_arguments(APP
"CONSOLE;DLL;IMPORTANT" "CONSOLE;CONSOLE_GUI;DLL;IMPORTANT"
"NAME;FOLDER" "NAME;FOLDER"
"DATA;DEFINITIONS;DEPENDS;LIBRARIES;RES" "DATA;DEFINITIONS;DEPENDS;LIBRARIES;RES"
${ARGN} ${ARGN}
@@ -709,7 +710,7 @@ function(wx_add name group)
if(APP_DLL) if(APP_DLL)
add_library(${target_name} SHARED ${src_files}) add_library(${target_name} SHARED ${src_files})
else() else()
if(APP_CONSOLE OR group STREQUAL Tests) if(APP_CONSOLE OR APP_CONSOLE_GUI)
set(exe_type) set(exe_type)
else() else()
set(exe_type WIN32 MACOSX_BUNDLE) set(exe_type WIN32 MACOSX_BUNDLE)

View File

@@ -37,7 +37,7 @@ set(TEST_DRAWING_DATA
drawing/references/image_test_image_gdiplus-6.1_2_ref.png drawing/references/image_test_image_gdiplus-6.1_2_ref.png
) )
wx_add_test(test_drawing ${TEST_DRAWING_SRC} wx_add_test(test_drawing CONSOLE_GUI ${TEST_DRAWING_SRC}
DATA ${TEST_DRAWING_DATA} DATA ${TEST_DRAWING_DATA}
) )
if(wxUSE_SOCKETS) if(wxUSE_SOCKETS)

View File

@@ -181,7 +181,7 @@ set(TEST_GUI_DATA
intl/ja/internat.po intl/ja/internat.po
) )
wx_add_test(test_gui ${TEST_GUI_SRC} wx_add_test(test_gui CONSOLE_GUI ${TEST_GUI_SRC}
DATA ${TEST_GUI_DATA} DATA ${TEST_GUI_DATA}
) )
if(wxUSE_AUI) if(wxUSE_AUI)

View File

@@ -17,7 +17,7 @@ set(TEST_SRC
allheaders.h allheaders.h
) )
wx_add_test(test_headers ${TEST_SRC}) wx_add_test(test_headers CONSOLE_GUI ${TEST_SRC})
if(wxUSE_SOCKETS) if(wxUSE_SOCKETS)
wx_exe_link_libraries(test_headers wxnet) wx_exe_link_libraries(test_headers wxnet)
endif() endif()