Resource file handling for exe icon for MinGW
authorPerttu Ahola <celeron55@gmail.com>
Sat, 15 Oct 2011 14:05:16 +0000 (17:05 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Sat, 15 Oct 2011 14:05:16 +0000 (17:05 +0300)
src/CMakeLists.txt

index 019f5ad7b135b85646b939a3fa3b41899b745885..6254d027ed1c3927e20c8f8a2abd185628f3f1e5 100644 (file)
@@ -129,8 +129,16 @@ set(common_SRCS
 )
 
 # This gives us the icon
-if(WIN32 AND MSVC)
-       set(common_SRCS ${common_SRCS} winresource.rc)
+if(WIN32)
+       if(MINGW)
+               ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/winresource_rc.o
+                       COMMAND windres.exe -I${CMAKE_CURRENT_SOURCE_DIR}
+                       -i${CMAKE_CURRENT_SOURCE_DIR}/winresource.rc
+                       -o ${CMAKE_CURRENT_BINARY_DIR}/winresource_rc.o)
+               SET(common_SRCS ${common_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/winresource_rc.o)
+       else(MINGW) # Probably MSVC
+               set(common_SRCS ${common_SRCS} winresource.rc)
+       endif(MINGW)
 endif()
 
 # Client sources