diff options
author | saurabhb17 | 2020-02-26 16:20:48 +0530 |
---|---|---|
committer | GitHub | 2020-02-26 16:20:48 +0530 |
commit | b77f5d9d8097c38159c6f60917995d6af13bbe1c (patch) | |
tree | 1392c90227aeea231c1d86371131e04c40382918 /CMakeModules/MinGWResourceCompiler.cmake | |
parent | dadc4d490966a24efe15b5cc533ef8695986048a (diff) | |
parent | 003d02608917e7a69d1a98438837e94ccf68352a (diff) | |
download | KiCad-eSim-b77f5d9d8097c38159c6f60917995d6af13bbe1c.tar.gz KiCad-eSim-b77f5d9d8097c38159c6f60917995d6af13bbe1c.tar.bz2 KiCad-eSim-b77f5d9d8097c38159c6f60917995d6af13bbe1c.zip |
Merge pull request #4 from FOSSEE/develop
merging dev into master
Diffstat (limited to 'CMakeModules/MinGWResourceCompiler.cmake')
-rw-r--r-- | CMakeModules/MinGWResourceCompiler.cmake | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/CMakeModules/MinGWResourceCompiler.cmake b/CMakeModules/MinGWResourceCompiler.cmake new file mode 100644 index 0000000..0e13ee5 --- /dev/null +++ b/CMakeModules/MinGWResourceCompiler.cmake @@ -0,0 +1,44 @@ +# 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) + # Resource compiler name. + if(NOT DEFINED CMAKE_RC_COMPILER) + set(CMAKE_RC_COMPILER windres.exe) + endif(NOT DEFINED CMAKE_RC_COMPILER) + dbg_msg("CMAKE_RC_COMPILER: ${CMAKE_RC_COMPILER}") + + # Input file. + set(_IN "${CMAKE_CURRENT_SOURCE_DIR}/${_NAME}.rc") + dbg_msg("_IN: ${_IN}") + + # Output file. + set(_OUT "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_NAME}.dir/${_NAME}_rc.obj") + dbg_msg("_OUT: ${_OUT}") + + # Include directories. + 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}") + + # windres arguments. + set(_ARGS ${_WINDRES_INCLUDE_DIRS} -i${_IN} -o${_OUT}) + dbg_msg("_ARGS: ${_ARGS}") + + # Compile resource file. + add_custom_command(OUTPUT ${_OUT} + COMMAND ${CMAKE_RC_COMPILER} + ARGS ${_ARGS} + COMMENT "Compiling ${_NAME}'s resource file" + VERBATIM) + + # Set a NAME_RESOURCES variable + string(TOUPPER ${_NAME} _NAME_UPPER) + set(${_NAME_UPPER}_RESOURCES ${_OUT}) + dbg_msg("${_NAME_UPPER}_RESOURCES: ${${_NAME_UPPER}_RESOURCES}") +endmacro(mingw_resource_compiler) |