[CMake] configure_file: escaping (single) quotes

Franck Houssen franck.houssen at inria.fr
Tue Jan 9 05:23:52 EST 2018


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


<blockquote>








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// ' # ' /}" 

</blockquote>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180109/a04723e4/attachment.html>


More information about the CMake mailing list