[CMake] 'recursive' or multiple level @@ replacement in configure_file

David Cole david.cole at kitware.com
Thu May 5 09:11:55 EDT 2011


On Thu, May 5, 2011 at 7:08 AM, J.S. van Bethlehem <
j.s.van.bethlehem at astro.rug.nl> wrote:

> Hello,
>
> Today I was trying something along the following lines:
> in CMakeLists.txt
> set(BASENAME some_text)
> set(${BASENAME}_DIR /some/path)
> set(${BASENAME}_SHARE /some/other/path)
> set(${BASENAME}_INCLUDES file1.h;file2.h;file3.h)
> configure_file(config.h.in config.h @ONLY)
>
> and in config.h.in do:
> set(INSTALL_PATH @@BASENAME at _DIR@)
> foreach(incl ${INSTALL_PATH})
> # do something
> endforeach(incl ${INSTALL_PATH})
>
> My expectation was that first @BASENAME@ would evaluate to 'some_text'
> after which @some_text_DIR@ would evaluate to the respective value. This
> fails, so the obvious question is: am I trying something that is simply not
> possible, or should I use different syntax to accomplish this?
>
> Yours sincerely,
> Jakob van Bethlehem
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


Why are you putting CMake script code into the file config.h.in?

Seems like you want to generate the .h.in file based on a CMake loop, and
*then* use it in a configure_file call...

What do you want the final .h file to look like?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110505/eff2f4e6/attachment.htm>


More information about the CMake mailing list