-
Alexandru Croitor authoredAlexandru Croitor authored
finalizers2.cmake 724 B
# Use case 2: Provide a custom Info.plist default
function(qt_add_executable target)
add_executable(${target} ${ARGN})
# ....
# Register finalizer to set MACOSX_BUNDLE_INFO_PLIST
# if it's not set already set.
cmake_language(DEFER CALL qt_auto_set_bundle_info_list "${target}")
endfunction()
function(qt_auto_set_bundle_info_list target)
get_target_property(info_plist "${target}" MACOSX_BUNDLE_INFO_PLIST)
if(NOT info_plist)
set(info_plist "${Qt6_DIR}/Info.plist")
set_target_properties("${target}" PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${info_plist}")
endif()
endfunction()
# Mini project
cmake_minimum_required(VERSION 3.15)
project(app)
qt_add_executable(app main.cpp)