[Cmake] Troubles figure out how to include .RES files for .NET

Bill Hoffman bill.hoffman at kitware.com
Thu Apr 24 09:17:23 EDT 2003


You can add a .rc file into the source list for a library or executable,
and cmake will do the right thing.   If you have some other program that
generates the .rc file, then you will have to use a custom command to create
the .rc file.

If you look at the source for CMake, in the MFCDialog directory, you
can see an example of using a .rc file:

SET( SRCS 
CMakeSetup.cpp
MakeHelp.cpp
CMakeSetup.rc
CMakeSetupDialog.cpp
PathDialog.cpp
PropertyList.cpp
StdAfx.cpp
CMakeCommandLineInfo.cpp
)

# add stuff to use MFC in this executable
ADD_DEFINITIONS(-D_AFXDLL)
SET(CMAKE_MFC_FLAG 6)

ADD_EXECUTABLE(CMakeSetup WIN32 ${SRCS})
TARGET_LINK_LIBRARIES(CMakeSetup CMakeLib)
ADD_DEPENDENCIES(CMakeSetup cmake)


-Bill


At 09:45 PM 4/24/2003, Robert Mathews wrote:
>I'm trying to convince CMake to perform what should be a simple task - to call the resource compiler on a .rc file to generate a .res file that the linker can link into the target program. 
> 
>Yet, I can't convince CMake to generate a .vcproj file that represents this.  In particular, I find myself arguing with CMake over whether a .rc file is really source or not (There seems to be a hardcoded list of what is a source file or not, ie ".cxx,.c,.cpp,...in". The SOURCE_GROUP command may be intended to override this, but it has only 4 lines (46 words) of documentation!, so I can't really tell). 
> 
>Actually, my task is slightly more complex, not that it matters since I can't get CMake to represent the first step. I'm actually using the message compiler to generate the .rc files, which I then call the resource compiler on to generate the .res files, which then get linked into a library. 
> 
>I'd offer more details, but I figure that this is the sort of thing that someone might have figured out already.  Has anyone, or should I start posting what I've figure out so far?
> 
>I've read all the docs at the www.cmake.org site. If anyone else has documentation or examples,  I'd welcome that. 
> 
>Rob. 






More information about the CMake mailing list