Skip to content

From cached variables to command line arguments

Mayeul d'Avezac edited this page Apr 24, 2014 · 2 revisions

It is useful to pass previously determined configurations, say the blas libraries, to external project. In practice, this means finding of group of cached variables and transforming them into something the CMake program understand (-DSomething_LIBRARY=here).

include(CachedVariables)
cached_variables(
    <OUTVAR>  # name of the output variable
    <PATTERN> # Pattern the variables should match, e.g. "BLAS_.*"
)

The output is a list BLAS_something_LIBRARY=this;BLAS_other_LIBRARY=that;BLAS_INCLUDE_DIR=here, that can be used to configure an external project.

Clone this wiki locally