From 4b0dc5819b5783300d057b7b46a0dc135e91e3a0 Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 18 May 2016 11:22:07 +0000 Subject: [PATCH] CMake: correctly define and use the add_resource function. --- res/CMakeLists.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/res/CMakeLists.txt b/res/CMakeLists.txt index 06ec0e1c..ee8b3728 100644 --- a/res/CMakeLists.txt +++ b/res/CMakeLists.txt @@ -3,17 +3,19 @@ set(resource_root ${CMAKE_CURRENT_SOURCE_DIR}/) set(resource_list) if(WIN32) set(rc_file ${CMAKE_CURRENT_BINARY_DIR}/resources.rc) - file(WRITE ${rc_file} "// Autogenerated; do not edit\n") + file(WRITE ${rc_file} "// Autogenerated; do not edit\n#include\n") function(add_resource name) set(source ${CMAKE_CURRENT_SOURCE_DIR}/${name}) - list(GET "${ARGN}" 0 id) - if(id STREQUAL NOTFOUND) + if(${ARGC} GREATER 1) + set(id ${ARGV1}) + else() string(REPLACE ${resource_root} "" id ${source}) endif() - list(GET "${ARGN}" 1 type) - if(type STREQUAL NOTFOUND) + if(${ARGC} GREATER 2) + set(type ${ARGV2}) + else() set(type RCDATA) endif() file(SHA512 "${source}" hash) @@ -105,8 +107,8 @@ endfunction() # Second, register all resources. if(WIN32) - add_resource(win32/icon.ico RT_ICON_GROUP APP_ICON) - add_resource(win32/manifest.xml RT_MANIFEST APP_MANIFEST) + add_resource(win32/icon.ico APP_ICON ICON) + add_resource(win32/manifest.xml APP_MANIFEST RT_MANIFEST) elseif(APPLE) add_iconset (cocoa/AppIcon.iconset) add_xib (cocoa/MainMenu.xib)