2008-04-13 19:07:32 +00:00
|
|
|
# resource compilation for mingw (http://www.cmake.org/Bug/view.php?id=4068)
|
|
|
|
|
|
|
|
macro(dbg_msg _MSG)
|
|
|
|
# message(STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
|
|
|
|
endmacro(dbg_msg)
|
|
|
|
|
|
|
|
macro(mingw_resource_compiler _NAME)
|
2008-04-16 04:00:19 +00:00
|
|
|
# Input file.
|
2008-04-13 19:07:32 +00:00
|
|
|
set(_IN "${CMAKE_CURRENT_SOURCE_DIR}/${_NAME}.rc")
|
|
|
|
dbg_msg("_IN: ${_IN}")
|
|
|
|
|
2008-04-16 04:00:19 +00:00
|
|
|
# Output file.
|
2008-04-18 08:04:54 +00:00
|
|
|
set(_OUT "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_NAME}.dir/${_NAME}_rc.obj")
|
2008-04-13 19:07:32 +00:00
|
|
|
dbg_msg("_OUT: ${_OUT}")
|
|
|
|
|
2008-04-16 04:00:19 +00:00
|
|
|
# Include directories.
|
2008-04-13 19:07:32 +00:00
|
|
|
set(_WINDRES_INCLUDE_DIRS -I${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
foreach(wx_include_dir ${wxWidgets_INCLUDE_DIRS})
|
|
|
|
set(_WINDRES_INCLUDE_DIRS ${_WINDRES_INCLUDE_DIRS} -I${wx_include_dir})
|
|
|
|
endforeach(wx_include_dir ${wxWidgets_INCLUDE_DIRS})
|
|
|
|
dbg_msg("_WINDRES_INCLUDE_DIRS: ${_WINDRES_INCLUDE_DIRS}")
|
|
|
|
|
2008-04-16 04:00:19 +00:00
|
|
|
# windres.exe arguments.
|
2008-04-13 19:07:32 +00:00
|
|
|
set(_ARGS ${_WINDRES_INCLUDE_DIRS} -i${_IN} -o${_OUT})
|
|
|
|
dbg_msg("_ARGS: ${_ARGS}")
|
|
|
|
|
2008-04-16 04:00:19 +00:00
|
|
|
# Compile resource file.
|
2008-04-13 19:07:32 +00:00
|
|
|
add_custom_command(OUTPUT ${_OUT}
|
|
|
|
COMMAND windres.exe
|
|
|
|
ARGS ${_ARGS}
|
2008-05-01 17:09:51 +00:00
|
|
|
COMMENT "Compiling ${_NAME}'s resource file"
|
2008-04-13 19:07:32 +00:00
|
|
|
VERBATIM)
|
2008-04-16 04:00:19 +00:00
|
|
|
|
|
|
|
# Set a NAME_RESOURCES variable
|
|
|
|
string(TOUPPER ${_NAME} _NAME_UPPER)
|
|
|
|
set(${_NAME_UPPER}_RESOURCES ${_OUT})
|
|
|
|
dbg_msg("${_NAME_UPPER}_RESOURCES: ${${_NAME_UPPER}_RESOURCES}")
|
2008-04-13 19:07:32 +00:00
|
|
|
endmacro(mingw_resource_compiler)
|