[CMake] Win DLL with rc-file...

Lars Pechan lars.pechan at parkerpechan.com
Mon Oct 25 20:14:30 EDT 2004


Hello,
I'm trying to create a Win32 DLL that contains some resources.

I've read that you should be able to just add an rc-file to an exe or a 
lib/dll and CMake should figure out what to do.

In my CMakeLists.txt I have

SET(RCFILE XX.rc)
ADD_LIBRARY(libX SHARED XX.c ${RCFILE})

The rc-file is generated on the fly and lives in 
${CMAKE_CURRENT_BINARY_DIR} whereas XX.c lives in 
${CMAKE_CURRENT_SOURCE_DIR}. I have tested marking ${RCFILE} as 
GENERATED using SET_SOURCE_FILES_PROPERTIES(${RCFILE} PROPERTIES 
GENERATED true) but that makes no difference whatsoever.

The link line in the generated Makefile contains no trace of the 
res-file (assuming the generation is from .rc to .res for the linker).

However, if I manually add the (hand-generated) .res file to the linker 
line everything is fine.

Any ideas why this is not working?

/Lars



More information about the CMake mailing list