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

William A. Hoffman bill.hoffman at kitware.com
Sat Apr 26 11:05:59 EDT 2003


1. I saw the following, and I do not agree, all of our projects are using
SET now, I think there is a misunderstanding on your part:
## We need some of the stuff that was depreciated, like the SOURCE_FILES 
command
, because
## the SET command doesn't work as well.

You should switch to SET..., and let us know what the problems are.
The big difference is that SET variables must be dereferenced with ${VAR} and
SOURCE_FILES lists just used the name.


2.   The problem with your custom command is that the target is incorrect.
There is no target ALL.

    ADD_CUSTOM_COMMAND(
            SOURCE ${MC_FILE}
            OUTPUTS ${RC_FILE}
            COMMAND ${MESSAGE_COMPILER}
            ARGS ${MC_FILE}
            TARGET ALL
    )

A Target can be one of three things:
  - Library from ADD_LIBRARY
  - Executable from ADD_EXECUTABLE
  - custom target from ADD_CUSTOM Target.

In this case you want the TARGET of the custom command to be the
library that contains the .rc file in its sources.

So, it should be something like this:

# tell cmake that foo.rc is a generated file
SET_SOURCE_FILE_PROPERTIES(foo.rc GENERATED)
ADD_LIBRARY(FOO foo.rc  foo.cxx)     # create a library with foo.rc and 
other sources
# add a custom command to generate foo.rc from foo.m
ADD_CUSTOM_COMMAND(
SOURCE foo.mc   # the source is the .mc file
OUTPUTS foo.rc    # the output file is the foo.rc file
COMMAND ${MESSAGE_COMPILER} ARGS foo.mc
DEPENDS foo.mc  # if foo.rm changes re-run the command
TARGET FOO)  # associate this custom command with the library FOO


At 10:32 AM 4/26/2003 -0400, you wrote:
>----- 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.
>
> >






More information about the CMake mailing list