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

Robert Mathews rmathews at envoyww.com
Sat Apr 26 10:32:58 EDT 2003


----- Original Message -----
From: "Bill Hoffman" <bill.hoffman at kitware.com>
To: "Robert Mathews" <rmathews at envoyww.com>; "Robert Mathews"
<rmathews at envoyww.com>; <cmake at public.kitware.com>
Sent: Friday, April 25, 2003 9:46 AM
Subject: Re: [Cmake] Troubles figure out how to include .RES files for .NET


> Can you send a small example of what you want to do, and the
> cmake list code you have written to do it.

Sure. I made a small project with 1 root directory, a subdir called
"allerrors" where I'm working, and the CMakeList code that attempts to
describe the .rc file generation.

I also run CMakesetup and generated the resulting .vcproj and solution
files. That clutters the directory I bit, but I thought it might help you if
you didn't happen to have .NET around.

Any, I tarred && gzipped it up. It's attached.

>
>  From what I understand, you are trying to do this:
> genRc -> some program you have that generates a .rc file from a .res file.
That is correct.

I'm using the Microsoft Message Compiler to generate the .rc file because it
generates resources in the form that the operating system understands.

>
> Is that correct?
>
> -Bill
>
> At 08:00 PM 4/25/2003, Robert Mathews wrote:
> >I apologize for being noisy here. Getting past this regex error, I find
the
> >the .vcproj files generated seem to reference the custom build step, but
> >that the custom build step itself never seems to reference the message
> >compiler. This is confirmed by the fact the when I run Visual Studio .NET
> >and compile it, the build "succeeds" but no .rc file is generated and no
> >library is created.
> >
> >What should I look for next?
> >
> >Rob.
> >
> >----- Original Message -----
> >From: "Robert Mathews" <rmathews at envoyww.com>
> >To: <cmake at public.kitware.com>; "Bill Hoffman" <bill.hoffman at kitware.com>
> >Sent: Friday, April 25, 2003 7:46 PM
> >Subject: Re: [Cmake] Troubles figure out how to include .RES files for
.NET
> >
> >
> >> Never mind about the error messages. They were caused by me using
> >> SOURCE_GROUP statements like this:
> >>
> >> SOURCE_GROUP(RESOURCE_SOURCE *.rc)
> >> SOURCE_GROUP(MESSAGE_SOURCE *.mc)
> >> SOURCE_GROUP(IDL_SOURCE *.idl)
> >>
> >> "*.rc", while the usual expression for specifying a file, are not
correct
> >> regular expressions.
> >>
> >> It would be nice if cmake spat out the text for the regular expression
> >that
> >> it couldn't compile.
> >>
> >> Rob.
> >>
> >> ----- Original Message -----
> >> From: "Robert Mathews" <rmathews at envoyww.com>
> >> To: <cmake at public.kitware.com>; "Bill Hoffman"
<bill.hoffman at kitware.com>
> >> Sent: Friday, April 25, 2003 7:20 PM
> >> Subject: Re: [Cmake] Troubles figure out how to include .RES files for
> >.NET
> >>
> >>
> >> > Now I'm debugging the part where I need a custom command.
> >> >
> >> > I'm try to say something like this:
> >> > 1. billingerrors.mc generates billingerrors.rc via the
MESSAGE_COMPILER
> >> > (mc.exe)
> >> > 2. take billingerrors.rc and compile it into a dll called
> >> > pwmsg_billingerrors.mc
> >> >
> >> > I currently get the error:
> >> > Deleting intermediate files and output files for project 'allerrors',
> >> > configuration 'Debug|Win32'.
> >> >
> >> > Building Custom Rule allerrors.vcproj.cmake
> >> >
> >> > cmRegularExpression::compile(): ?+* follows nothing.
> >> >
> >> > cmRegularExpression::compile(): Error in compile.
> >> >
> >> > cmRegularExpression::compile(): ?+* follows nothing.
> >> >
> >> > cmRegularExpression::compile(): Error in compile.
> >> >
> >> > cmRegularExpression::compile(): ?+* follows nothing.
> >> >
> >> > cmRegularExpression::compile(): Error in compile.
> >> >
> >> > So it seems to be executing the custom command, but something is
going
> >> wrong
> >> > and I can't figure out what. In particular, I've verified that all
the
> >> input
> >> > paths are correct.
> >> >
> >> > Is there a way to make CMake spit out more information about the text
of
> >> the
> >> > regular expression that it is trying to compile?
> >> >
> >> > The input looks something like this:
> >> >
> >> > ===start-here===================================================
> >> > SOURCE_FILES(MC_FILES billingerrors.mc)
> >> >
> >> > ## Generate all targets that describe how to go from .mc to .rc
> >> > FOREACH(MC_FILE ${MC_FILES})
> >> >  STRING(REGEX REPLACE "\\.mc" ".rc" RC_FILE ${MC_FILE} )
> >> >  ADD_CUSTOM_COMMAND(
> >> >   SOURCE "${MC_FILE}"
> >> >   COMMAND "${MESSAGE_COMPILER}"
> >> >   ARGS "${MC_FILE}"
> >> >   OUTPUTS "${RC_FILE}"
> >> >   TARGET ALL
> >> >  )
> >> > ENDFOREACH(MC_FILE)
> >> >
> >> > ## Generate the list of message DLLS that allerrors depends on
> >> > SET(MESSAGE_DLLS "")
> >> > FOREACH(MC_FILE ${MC_FILES})
> >> >  STRING(REGEX REPLACE "\\.mc" "" FILE_BASE ${MC_FILE} )
> >> >  SET(MESSAGE_DLL pwmsg_${FILE_BASE})
> >> >  SET(MESSAGE_DLLS ${MESSAGE_DLLS} ${MESSAGE_DLL})
> >> > ENDFOREACH(MC_FILE)
> >> >
> >> > ## Generate all the library targets that depend on the .res files
> >> > FOREACH(MC_FILE ${MC_FILES})
> >> >  STRING(REGEX REPLACE "\\.mc" "" FILE_BASE ${MC_FILE} )
> >> >  SET(MESSAGE_DLL pwmsg_${FILE_BASE} )
> >> >  ADD_LIBRARY(${MESSAGE_DLL} SHARED ${MC_FILE} )
> >> > ENDFOREACH(MC_FILE)
> >> >
> >> > ADD_CUSTOM_TARGET(allerrors ALL)
> >> > ADD_DEPENDENCIES(allerrors ${MESSAGE_DLLS})
> >> > ===end-here===================================================
> >> >
> >> > ----- Original Message -----
> >> > From: "Bill Hoffman" <bill.hoffman at kitware.com>
> >> > To: "Robert Mathews" <rmathews at envoyww.com>;
<cmake at public.kitware.com>
> >> > Sent: Thursday, April 24, 2003 9:17 AM
> >> > Subject: Re: [Cmake] Troubles figure out how to include .RES files
for
> >> .NET
> >> >
> >> >
> >> > > 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.
> >> > >
> >> > >
> >> > >
> >> >
> >> > _______________________________________________
> >> > Cmake mailing list
> >> > Cmake at public.kitware.com
> >> > http://public.kitware.com/mailman/listinfo/cmake
> >> >
> >>
> >> _______________________________________________
> >> Cmake mailing list
> >> Cmake at public.kitware.com
> >> http://public.kitware.com/mailman/listinfo/cmake
> >>
> >
> >_______________________________________________
> >Cmake mailing list
> >Cmake at public.kitware.com
> >http://public.kitware.com/mailman/listinfo/cmake
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mc_example.tar.gz
Type: application/x-gzip
Size: 11276 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake/attachments/20030426/155817d4/attachment.bin>


More information about the CMake mailing list