summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authorVenugopal Shivashankar <Venugopal.Shivashankar@qt.io>2020-06-11 23:32:38 +0200
committerVenugopal Shivashankar <Venugopal.Shivashankar@qt.io>2020-06-15 09:52:01 +0000
commit33b7bf61824b80cf71042c31c505b73e82e11b37 (patch)
treeab7d66d713d152b957deb7dae415aa57df8722ab /doc/src/snippets
parentdd4b32818d435602f6f63fbff0ff79395c9d8c4f (diff)
Doc: Add cmake instructions for app icon setup
Added CMake-specific app icon setup instructions for windows and macOS. Change-Id: I81378ba8cee010685811b34b4dee85fdbe2b2edf Fixes: QTBUG-83696 Pick-to: 5.15 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/code/CMakeLists.txt24
1 files changed, 24 insertions, 0 deletions
diff --git a/doc/src/snippets/code/CMakeLists.txt b/doc/src/snippets/code/CMakeLists.txt
new file mode 100644
index 000000000..52c26898e
--- /dev/null
+++ b/doc/src/snippets/code/CMakeLists.txt
@@ -0,0 +1,24 @@
+cmake_minimum_required(VERSION 3.14)
+project(qt5app LANGUAGES CXX)
+
+if (WIN32)
+#! [appicon_windows]
+ set(APP_ICON_RESOURCE_WINDOWS "${CMAKE_CURRENT_SOURCE_DIR}/qt5app.rc")
+ add_executable(qt5app main.cpp ${APP_ICON_RESOURCE_WINDOWS})
+#! [appicon_windows]
+elseif (APPLE)
+#! [appicon_macOS]
+ # NOTE: Don't include the path in MACOSX_BUNDLE_ICON_FILE -- this is
+ # the property added to Info.plist
+ set(MACOSX_BUNDLE_ICON_FILE qt5app.icns)
+
+ # And this part tells CMake where to find and install the file itself
+ set(APP_ICON_MACOSX ${CMAKE_CURRENT_SOURCE_DIR}/qt5app.icns)
+ set_source_files_properties(${APP_ICON_MACOSX} PROPERTIES
+ MACOSX_PACKAGE_LOCATION "Resources")
+
+ add_executable(qt5app MACOSX_BUNDLE main.cpp ${APP_ICON_MACOSX})
+#! [appicon_macOS]
+else()
+ add_executable(qt5app main.cpp)
+endif()