<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7651.59">
<TITLE>RE: [CMake] @MY_VAR@ are replaced by empty string !</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>
<BR>
<BR>
<BR>
<BR>
<P><FONT SIZE=2>-----Original Message-----<BR>
From: Bill Hoffman [<A HREF="mailto:bill.hoffman@kitware.com">mailto:bill.hoffman@kitware.com</A>]<BR>
Sent: Thu 2/14/2008 2:45 PM<BR>
To: Martin Lütken; cmake<BR>
Subject: Re: [CMake] @MY_VAR@ are replaced by empty string !<BR>
<BR>
Martin Lütken wrote:<BR>
><BR>
><BR>
><BR>
><BR>
><BR>
> -----Original Message-----<BR>
> From: Bill Hoffman [<A HREF="mailto:bill.hoffman@kitware.com">mailto:bill.hoffman@kitware.com</A>]<BR>
> Sent: Wed 2/13/2008 7:50 PM<BR>
> To: Martin Lütken<BR>
> Cc: cmake@cmake.org<BR>
> Subject: Re: [CMake] @MY_VAR@ are replaced by empty string !<BR>
><BR>
> Martin Lütken wrote:<BR>
> > SHORT:<BR>
> > It's seems impossible to contruct a string containing something like<BR>
> this:<BR>
> > "@MY_VAR@". The whole thing gets replaced by an empty string regardless<BR>
> > whether<BR>
> > the MY_VAR variable is set or not. It is possible to create a string<BR>
> > like "@ MY_VAR@",<BR>
> > but that is not quite the same.<BR>
> ><BR>
> ><BR>
> > ACTUAL PROBLEM DESCRIPTION:<BR>
> > I am trying to create cmake files for Gtk+ and asssociated libs among<BR>
> > those Pango!<BR>
> ><BR>
> > In order to run the glib-mkenums perl script from CMake I need to be<BR>
> > able to contruct<BR>
> > a custom command with strings containing the above "@MY_VAR@" construct<BR>
> > which the script<BR>
> > uses in a similar fashion as CMake does in it's CONFIGURE_FILE command.<BR>
> ><BR>
> > Any suggestions? Or do I need to file a bug-report ?<BR>
> ><BR>
><BR>
> Can you use COPY_ONLY? Or do you need to configure some variables in<BR>
> the file, just not all of them?<BR>
><BR>
> Actually I need that as part of running a CUSTOM_COMMAND. So I need to<BR>
> construct parameters like that<BR>
> for a perlscript that creates c-source code from a bunch of header files.<BR>
><BR>
<BR>
I still don't get it... You want to run a perl script from a custom<BR>
command, that much I get... However, I don't know why it needs to be<BR>
configured?<BR>
<BR>
-Bill<BR>
<BR>
<BR>
Hi again I might have figured most of it out now. I learned from another posting here that I should not quote the commands.<BR>
That helped and after a lot of "escaping" it allmost works! Now I just seem to have a problem with the WORKING_DIRECTORY which seems to be ignored completely! I am using CMake version "2.4-patch 7".<BR>
<BR>
--- My original makefile was like this: ---<BR>
<BR>
( cd $(srcdir) && $(GLIB_MKENUMS) \<BR>
--fhead "#undef GTK_DISABLE_DEPRECATED\n#define GTK_ENABLE_BROKEN\n#include \"gtk.h\"\n#include \"gtkprivate.h\"\n#include \"gtkalias.h\"\n" \<BR>
--ftail "#define __GTK_TYPE_BUILTINS_C__\n#include \"gtkaliasdef.c\"\n" \<BR>
--fprod "\n/* enumerations from \"@filename@\" */" \<BR>
--vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \<BR>
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \<BR>
--vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (g_intern_static_string (\"@EnumName@\"), values);\n }\n return etype;\n}\n" \<BR>
$(gtk_public_h_sources) ) gtktypebuiltins.c <BR>
<BR>
<BR>
--- And I got it transformed to: ---<BR>
<BR>
ADD_CUSTOM_TARGET ( gtkMkEnumsTarget ALL echo "Creating ...." )<BR>
SET ( type )<BR>
SET ( outFileName "gtktypebuiltins" )<BR>
ADD_CUSTOM_COMMAND(<BR>
OUTPUTS ${CMAKE_CURRENT_BINARY_DIR}/${outFileName}.c<BR>
SOURCE gtk.symbols<BR>
COMMAND ${glib-mkenums_EXECUTABLE} --fhead \"\#undef GTK_DISABLE_DEPRECATED\\n\#define GTK_ENABLE_BROKEN\\n\#include \\"gtk.h\\"\\n\#include \\"gtkprivate.h\\"\\n\#include \\"gtkalias.h\\"\\n\" --ftail \"\#define __GTK_TYPE_BUILTINS_C__\\n\#include \\"gtkaliasdef.c\\"\\n\" --fprod \"\\n/* enumerations from \\"@filename@\\" */\" --vhead \"GType\\n@enum_name@_get_type \(void\)\\n{\\n static GType etype = 0;\\n if \(etype == 0\) {\\n static const G@Type@Value values[] = {\" --vprod \" { @VALUENAME@, \\"@VALUENAME@\\", \\"@valuenick@\\" },\" --vtail \" { 0, NULL, NULL }\\n };\\n etype = g_@type@_register_static \(g_intern_static_string \(\\"@EnumName@\\"\), values\);\\n }\\n return etype;\\n}\\n\" ${${CBS_CURRENT}_PUBLIC_HEADER} > ${CMAKE_CURRENT_BINARY_DIR}/${outFileName}.c<BR>
TARGET gtkMkEnumsTarget<BR>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<BR>
)<BR>
ADD_SOURCE_FILE ( ${CMAKE_CURRENT_BINARY_DIR}/${outFileName}.c )<BR>
SET_SOURCE_FILES_PROPERTIES( ${CMAKE_CURRENT_BINARY_DIR}/${outFileName}.c GENERATED )<BR>
<BR>
----------<BR>
But the generated makefile does not switch to the requested WORKING_DIRECTORY but instead to<BR>
the CMAKE_CURRENT_BINARY_DIR regardless of what I set as WORKING_DIRECTORY.<BR>
<BR>
--- It looks something like this in the CMake generated makefile: ---<BR>
<BR>
@echo "Generating gtktypebuiltins.c"<BR>
cd /home/ml/code/cpaf/build_cbs/kdev_release/lgpl/gtk/gtk && ../../glib-main/gobject/glib-mkenums --fhead "#undef GTK_DISABLE_DEPRECATED\n#define GTK_ENABLE_BROKEN\n#include \"gtk.h\"\n#include \"gtkprivate.h\"\n#include \"gtkalias.h\"\n" --ftail "#define __GTK_TYPE_BUILTINS_C__\n#include \"gtkaliasdef.c\"\n" --fprod "\n/* enumerations from \"@filename@\" */" --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0 \n if (etype == 0) {\n static const G@Type@Value values[] = {" --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," --vtail " { 0, NULL, NULL }\n } \n etype = g_@type@_register_static (g_intern_static_string (\"@EnumName@\"), values) \n }\n return etype \n}\n" gtk.h ( ... LOTS_OF_HEADER_FILES .... ) > /home/ml/code/cpaf/build_cbs/kdev_release/lgpl/gtk/gtk/gtktypebuiltins.c<BR>
<BR>
--- problem: ---<BR>
The glib-mkenums script cannot find the header files since it's executed from the wrong working directory!<BR>
<BR>
Any suggestions ?<BR>
<BR>
-Martin Lutken<BR>
</FONT>
</P>
</BODY>
</HTML>