From 4862cbd4c6ddc68909b3738ee1ffd3926562cc03 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 17 Aug 2021 21:50:48 +0200 Subject: [PATCH] CMake: Allow to specify specific Info.plist.in file for samples --- build/cmake/functions.cmake | 11 ++++++++--- build/cmake/samples/CMakeLists.txt | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index 3604ab2cee..0233138ead 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -681,7 +681,7 @@ endfunction() # Add sample, test, demo or benchmark # wx_add( [CONSOLE|CONSOLE_GUI|DLL] [IMPORTANT] [SRC_FILES...] # [LIBRARIES ...] [NAME target_name] [FOLDER folder] -# [DATA ...] [DEFINITIONS ...] [RES ...]) +# [DATA ...] [DEFINITIONS ...] [RES ...] [PLIST ...) # name default target name # group can be Samples, Tests, Demos or Benchmarks # first parameter may be CONSOLE to indicate a console application or DLL to indicate a shared library @@ -696,6 +696,7 @@ endfunction() # DATA followed by required data files. Use a colon to separate different source and dest paths # DEFINITIONS list of definitions for the target # RES followed by WIN32 .rc files +# PLIST followed by macOS Info.plist.in file # # Additionally the following variables may be set before calling wx_add_sample: # wxSAMPLE_SUBDIR subdirectory in the samples/ folder to use as base @@ -721,7 +722,7 @@ function(wx_add name group) cmake_parse_arguments(APP "CONSOLE;CONSOLE_GUI;DLL;IMPORTANT" "NAME;FOLDER" - "DATA;DEFINITIONS;DEPENDS;LIBRARIES;RES" + "DATA;DEFINITIONS;DEPENDS;LIBRARIES;RES;PLIST" ${ARGN} ) @@ -868,8 +869,12 @@ function(wx_add name group) if(APPLE) if(NOT IPHONE) + set(PLIST_FILE "${wxSOURCE_DIR}/src/osx/carbon/Info.plist.in") + if(APP_PLIST) + set(PLIST_FILE "${wxSOURCE_DIR}/${SUB_DIR}/${APP_PLIST}") + endif() set_target_properties(${target_name} PROPERTIES - MACOSX_BUNDLE_INFO_PLIST "${wxSOURCE_DIR}/src/osx/carbon/Info.plist.in" + MACOSX_BUNDLE_INFO_PLIST "${PLIST_FILE}" RESOURCE "${wxSOURCE_DIR}/src/osx/carbon/wxmac.icns") endif() set_target_properties(${target_name} PROPERTIES diff --git a/build/cmake/samples/CMakeLists.txt b/build/cmake/samples/CMakeLists.txt index e4d4f788f9..89560710ce 100644 --- a/build/cmake/samples/CMakeLists.txt +++ b/build/cmake/samples/CMakeLists.txt @@ -38,7 +38,7 @@ wx_add_sample(dialup nettest.cpp LIBRARIES wxnet DEPENDS wxUSE_DIALUP_MANAGER) wx_add_sample(display) wx_add_sample(dnd dnd.cpp RES dnd.rc DATA wxwin.png DEPENDS wxUSE_DRAG_AND_DROP) wx_add_sample(docview docview.cpp doc.cpp view.cpp docview.h doc.h view.h - RES docview.rc LIBRARIES wxaui DEPENDS wxUSE_DOC_VIEW_ARCHITECTURE) + RES docview.rc PLIST Info.plist.in LIBRARIES wxaui DEPENDS wxUSE_DOC_VIEW_ARCHITECTURE) wx_add_sample(dragimag dragimag.cpp dragimag.h RES dragimag.rc DATA backgrnd.png shape01.png shape02.png shape03.png DEPENDS wxUSE_DRAGIMAGE) @@ -75,7 +75,7 @@ wx_add_sample(image image.cpp canvas.cpp canvas.h cursor_png.c RES image.rc foreach(lang ar bg cs de fr it ka pl ru sv ja ja_JP.EUC-JP) list(APPEND INTERNAT_DATA_FILES ${lang}/internat.po ${lang}/internat.mo) endforeach() -wx_add_sample(internat DATA ${INTERNAT_DATA_FILES} DEPENDS wxUSE_INTL) +wx_add_sample(internat DATA ${INTERNAT_DATA_FILES} PLIST Info.plist.in DEPENDS wxUSE_INTL) # IPC samples set(wxSAMPLE_FOLDER ipc) wx_add_sample(ipc client.cpp client.h connection.h ipcsetup.h NAME ipcclient LIBRARIES wxnet DEPENDS wxUSE_IPC)