[CMake] Need help generating a config file
Aaron Boxer
boxerab at gmail.com
Thu Oct 13 16:09:01 EDT 2016
Eric, thanks, I figured it out.
On Thu, Oct 13, 2016 at 3:27 PM, Eric Noulard <eric.noulard at gmail.com>
wrote:
>
>
> 2016-10-13 21:18 GMT+02:00 Aaron Boxer <boxerab at gmail.com>:
>
>> Hello,
>>
>> I have a foo.h.cmake.in file that I am using to generate a
>> foo_config.h file.
>>
>> Here is the line in my cmake file that generates the header:
>>
>> configure_file(${CMAKE_CURRENT_SOURCE_DIR}/foo.h.cmake.in
>> ${CMAKE_CURRENT_BINARY_DIR}/foo_config.h @ONLY)
>>
>
>
> You specified @ONLY option which means that only @VARNAME@ will be
> processed
> and not ${VARNAME}
>
>
>>
>>
>> I would like to define or undefine DEFINE in the config file
>> based on some cmake variables.
>>
>>
>> Here is my line in the foo.h.cmake.in file:
>>
>> #cmakedefine FOO_DEFINE ${SOME_CMAKE_VARIABLE}
>>
>
> Either you drop the @ONLY option of configure_file or you write
>
> #cmakedefine FOO_DEFINE @SOME_CMAKE_VARIABLE@
>
> and you should get what you want.
> @ONLY is very useful when you configure some kind of shell script template
> where $ shoudn't be interpreted by CMake condigure_file because it's meant
> to kept
> as is in the resulting configured file.
>
>
>
>>
>> However, I only get
>>
>> #define FOO_DEFINE ${SOME_CMAKE_VARIABLE}
>>
>> in the foo_config.h file.
>>
>>
>> Thanks,
>> Aaron
>>
>>
>>
>>
>>
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake
>>
>
>
>
> --
> Eric
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161013/8788567d/attachment-0001.html>
More information about the CMake
mailing list