2008-05-06

CMake, MinGW & application icons

http://www.thelins.se/johan/2006/10/cmake-qt-421-and-application-icons.html

IF(WIN32)
IF(MINGW)
FIND_PROGRAM(WINDRES windres)

IF(NOT WINDRES)
MESSAGE(FATAL_ERROR "windres not found - aborting")
ENDIF(NOT WINDRES)

FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/CMakeFiles/${PROJECT_NAME}.dir/resources")

# resource compilation for mingw
ADD_CUSTOM_COMMAND(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/CMakeFiles/${PROJECT_NAME}.dir/resources/version.o"
COMMAND ${WINDRES}
-I"${CMAKE_CURRENT_SOURCE_DIR}/resources"
-o"${CMAKE_CURRENT_SOURCE_DIR}/CMakeFiles/${PROJECT_NAME}.dir/resources/version.o"
-i"${CMAKE_CURRENT_SOURCE_DIR}/resources/version.rc"
)
SET(ADDITIONAL_SOURCES ${ADDITIONAL_SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeFiles/${PROJECT_NAME}.dir/resources/version.o")
ELSE(MINGW)
SET(ADDITIONAL_SOURCES ${ADDITIONAL_SOURCES} "resources/version.rc")
ENDIF(MINGW)
ENDIF(WIN32)

No comments: