[CMake] nested replacement with @@
Nico Schlömer
nico.schloemer at gmail.com
Thu Apr 11 12:50:46 EDT 2013
> Did you try protecting the $ that needs to be with \$
> Or
> set(PDOLLAR "$") and use ${PDOLLAR}
This is a pretty ugly hack, but also the one suggestion that actually
worked. Thanks!
--Nico
On Wed, Apr 10, 2013 at 8:49 PM, Eric Noulard <eric.noulard at gmail.com> wrote:
>
>
>
> 2013/4/10 Nico Schlömer <nico.schloemer at gmail.com>
>>
>> Hi all,
>>
>> in a ProjectContfigTemplate.cmake.in file, I'd like to have variables
>> such as ${${PROJECT_NAME}_VERSION}. In ${}-syntax, the nesting is
>> recognized properly, and this string would be replaced by, e.g.,
>> "2.1".
>>
>> I know need to have ${}-variables in the output file, so I tried to
>> switch to the @-syntax.
>
>
> then I guess you use configure_file(... @ONLY)
>
>>
>> Replacing the above line by
>>
>> @@PROJECT_NAME at _VERSION@
>>
>> doesn't work however: The output file contains
>>
>> @Myproject_VERSION@
>>
>> i.e., only the inner variable was replaced.
>>
>> How to fix this?
>
>
> May be it's a feature not a bug.
> (honestly I don't know but I guess the behavior has probably been here
> for ages so that people may rely on it)
>
> Did you try protecting the $ that needs to be with \$
> Or
> set(PDOLLAR "$") and use ${PDOLLAR}
>
> --
> Erk
> Le gouvernement représentatif n'est pas la démocratie --
> http://www.le-message.org
More information about the CMake
mailing list