[CMake] Compiling .rc file WITHOUT linking

Ted Berg tberg at vivox.com
Thu Jan 15 17:44:40 EST 2009


Eric Lemings wrote:
> Greetings,
> 
> How do you compile a .rc file into a .res file without linking it into a
> library or executable?
> 

Your paths and rc options may vary:

find_program( RC_EXECUTABLE NAMES rc )
set( BINARY_RES_DIR ${PROJECT_BINARY_DIR}/resources )

add_custom_command(
     OUTPUT ${BINARY_RES_DIR}/Resource.res
     COMMAND ${RC_EXECUTABLE} /l 0x409 /v 
/fo"${BINARY_RES_DIR}/Resource.res" ${PROJECT_SOURCE_DIR}/Resource.rc
     DEPENDS ${PROJECT_SOURCE_DIR}/Resource.rc
   )

add_custom_target(
     build_resources
     DEPENDS ${BINARY_RES_DIR}/Resource.res
   )



More information about the CMake mailing list