[CMake] Win DLL with rc-file...
Brad King
brad.king at kitware.com
Mon Oct 25 21:18:39 EDT 2004
Lars Pechan wrote:
> 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?
Sicne the .rc file is in the build tree, try specifying the full path:
SET(RCFILE ${CMAKE_CURRENT_BINARY_DIR}/XX.rc)
If the rc file is generated as the OUTPUTS of a custom command then you
do not need to mark it generated because the custom command will
automatically do so. Just be sure to specify it as a full path everywhere.
-Brad
More information about the CMake
mailing list