[CMake] Status of escaped characters in cmake?
Chris Green
chissg at comcast.net
Tue Jul 26 16:38:55 EDT 2005
Hi,
I've hit another problem with escaped characters: I wish to do a custom
command which calls perl with -e '<here-script>'. I'm still bashing around
with it, but what I have so far appears to confuse perl with lots of
escaped spaces that I didn't ask for.
For instance:
SET ( perl_cmd
"'m%defined_in\\s+\\\"?([^\\\";]+)[\\\";]% and do \\
{my @a = grep { -r \"$_/$1\" } split(\";\",
\"${include_directories}\"); \\
if ($a[0]) { $a[0]=\"$a[0]/$a[1]\"; \\
s%(defined_in\\s+)\\\"?([^\\\";]+)\\\"?%$1$a[0];%}};'"
)
MESSAGE ( STATUS "perl_cmd = ${perl_cmd}" )
ADD_CUSTOM_COMMAND (
OUTPUT ${linkdef_h_file}
MAIN_DEPENDENCY ${linkdef_h_in_file}
COMMAND ${PERL}
ARGS -wpe ${perl_cmd}
${linkdef_h_in_file} > ${linkdef_h_file}
)
produces:
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.2
# Custom command rule file for PlotFile_linkdef.h.
VLAND_root_util/src/PlotFile_linkdef.h:
../../../afs/fnal.gov/files/home/room3/greenc/VLAND/VLAND-test/VLAND_root_util/src/PlotFile_linkdef.h.in
VLAND_root_util/src/PlotFile_linkdef.h:
VLAND_root_util/src/VLAND_root_util.dir/PlotFile_linkdef.h.build.make
@echo "Generating PlotFile_linkdef.h"
cd /scratch1/greenc/VLAND-test_build/VLAND_root_util/src &&
/usr/local/bin/perl -wpe 'm%defined_in\s+\"?([^\";]+)[\";]%\ and\ do\ \
\ \ \ \ \ \ \ \ \ \ \ \ {my\ @a\ =\ grep\ {\ -r\ "$_/$1"\ }\ split(" ",\ "/afs/fnal.gov/files/home/room3/greenc/VLAND/VLAND-test/VLAND_root_util /scratch1/greenc/VLAND-test_build/include /afs/fnal.gov/files/code/e898/code17/BooNE_products/prd/root/v4_00_08g/Linux-2-4-2-3-2-GCC_3_4_1--opt/include") \ \
\ \ \ \ \ \ \ \ \ \ \ \ if\ ($a[0])\ {\ $a[0]="$a[0]/$a[1]" \ \
\ \ \ \ \ \ \ \ \ \ \ \ s%(defined_in\s+)\"?([^\";]+)\"?%$1$a[0] %}} ' /afs/fnal.gov/files/home/room3/greenc/VLAND/VLAND-test/VLAND_root_util/src/PlotFile_linkdef.h.in > /scratch1/greenc/VLAND-test_build/VLAND_root_util/src/PlotFile_linkdef.h
(apologies for the inevitable mail-client wrapping).
Am I doing something obviously wrong? How can I get this to work?
Thanks,
Chris.
--
Chris Green, MiniBooNE / LANL. Email greenc at fnal.gov
Tel: (630) 840-2167. Fax: (630) 840-3867
More information about the CMake
mailing list