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

Robert Mathews rmathews at envoyww.com
Fri Apr 25 19:20:26 EDT 2003


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.
>
>
>




More information about the CMake mailing list