For Windows
增添rc文件到工程中。
add file:
Source/myapp.rc
包含内容:
IDI_ICON1 ICON DISCARDABLE "Images/logo.ico"
他指明了图标文件的路径。
然后将这份rc文件添加到CMakeLists.txt中:
file( GLOB SourceFiles Source/*.cpp Source/myapp.rc )
add_executable(
${PROJECT_NAME}
MACOSX_BUNDLE
${SourceFiles}
${HeaderFiles}
${ResourceFiles}
${UISrcs}
)
For Mac OS X
在CMakeLists.txt中指明图标文件的路径,然后添加到executable 的依赖文件列表中
# CMAKE_AUTOMOC in ON so the MOC headers will be automatically wrapped.
set( CMAKE_AUTOMOC ON )
# NOTE: Don't include the path in MACOSX_BUNDLE_ICON_FILE -- this is
# the property added to Info.plist
# <key>CFBundleIconFile</key>
# <string>logo</string>
set(MACOSX_BUNDLE_ICON_FILE logo)
# And this part tells CMake where to find and insta