[CMake] @ONLY and nested variables

Ruslan Baratov ruslan_baratov at yahoo.com
Mon Sep 29 06:41:10 EDT 2014


You can run configure_package_config_file twice with code:

SET(@PACKAGE at _LIBS @@PACKAGE at _LIBRARIES@)

Also you can use configure_file command to create one file and include 
it with config file that was made by configure_package_config_file:

# CMakeLists.txt
configure_file(FooVars.cmake.in FooVars.cmake)
configure_package_config_file(FooConfig.cmake.in FooConfig.cmake ...)

install(FILES FooVars.cmake FooConfig.cmake ...)

# FooConfig.cmake.in
include(relative/path/to/FooVars.cmake)


On 25-Sep-14 03:09, Nico Schlömer wrote:
> Hi all,
>
> I would like to use CONFIGURE_PACKAGE_CONFIG_FILE() [1] instead of
> CONFIGURE_FILE() for my export configurations. Unfortunately, it seems
> that CONFIGURE_PACKAGE_CONFIG_FILE() only supports the @ONLY syntax. I
> do use nested variables names in the export configuration, though,
> e.g.,
> ```
> SET(${PACKAGE}_LIBS ${${PACKAGE}_LIBRARIES})
> ```
> Any idea how to translate this line into @ONLY syntax? Any other ideas?
>
> Cheers,
> Nico
>
>
> [1] http://www.cmake.org/cmake/help/v3.0/module/CMakePackageConfigHelpers.html



More information about the CMake mailing list