[CMake] configure_file: escaping (single) quotes

Franck Houssen franck.houssen at inria.fr
Tue Jan 9 05:32:09 EST 2018


OK. Got it to work ! Thanks 

----- Mail original -----

> De: "Marc CHEVRIER" <marc.chevrier at sap.com>
> À: "Franck Houssen" <franck.houssen at inria.fr>
> Cc: "CMake Mail List" <cmake at cmake.org>
> Envoyé: Mardi 9 Janvier 2018 11:26:55
> Objet: Re: [CMake] configure_file: escaping (single) quotes

> Yes, you have to rewrite your line as:

> CMD="mpirun -n @ MPIEXEC_PREFLAGS @ @ MPIEXEC_NUMPROC_FLAG @ @
> MPIEXEC_MAX_NUMPROCS @ @ MPIEXEC_POSTFLAGS @ "

> From: Franck Houssen <franck.houssen at inria.fr>
> Date: Tuesday 9 January 2018 at 11:23
> To: "CHEVRIER, Marc" <marc.chevrier at sap.com>
> Cc: CMake Mail List <cmake at cmake.org>
> Subject: Re: [CMake] configure_file: escaping (single) quotes

> ----- Mail original -----

> > De: "Marc CHEVRIER" <marc.chevrier at sap.com>
> 
> > À: "Franck Houssen" <franck.houssen at inria.fr>, "CMake Mail List"
> > <cmake at cmake.org>
> 
> > Envoyé: Mardi 9 Janvier 2018 10:29:30
> 
> > Objet: Re: [CMake] configure_file: escaping (single) quotes
> 

> > The problem comes from CMake evaluating variable VAR (i.e. expression
> > ${VAR…}) and detect wrong syntax.
> 

> > The solution is to specify option @ONLY to command configure_file to avoid
> > ${} evaluation.
> 

> The line after VAR is something like:

> VAR="${VAR// ' # ' /}"

> CMD="mpirun -n ${MPIEXEC_PREFLAGS} ${MPIEXEC_NUMPROC_FLAG}
> ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_POSTFLAGS}"

> I need MPIEXEC_* to be replaced. So, I need to use @ONLY and set all MPIEXEC
> variables with @ (but not $). Correct ?

> > From: CMake <cmake-bounces at cmake.org> on behalf of Franck Houssen
> > <franck.houssen at inria.fr>
> 
> > Date: Tuesday 9 January 2018 at 10:24
> 
> > To: CMake Mail List <cmake at cmake.org>
> 
> > Subject: [CMake] configure_file: escaping (single) quotes
> 

> > VAR="${VAR// ' # ' /}"
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180109/c41568e3/attachment-0001.html>


More information about the CMake mailing list