[CMake] Wrap CACHE variables

Dario Oliveri oliveridario89 at gmail.com
Sat Jan 10 02:46:12 EST 2015


How can I wrap cache variables from CMake scripts? Let's say I have a CMake
project, it depends on any third part library (says SFML or SDL), that
project expose a plenty of CACHE variables so that configuring them for
each build manually is a pain.

How can I configure from MY project THOSE variables so that the final
user/builder does not have to setup that garbage stuff? (say my project has
only 3 cache variables "build_win32", "build_max", "build_linux", I know
how to setup corresponding flags in dependencies, so why I can't do that
via script? having several dependencies could lead to hundreds of Cache
variables, configuring a cross platform build becomes unmaintainable and
error prone, also not every user would be able to do that because require
knowing details about dependencies)

The assumption is that a project will not use pre-built binaries for
dependencies but will instead include and in-build them (this has plenty
advantages, including ability to re-run unit tests also for dependencies,
catch misconfigurations in build system early, ability to really support
every compiler without having to redownload stuff or compile it manually,
this is the true power of CMAKE, just missing 1 detail to go):


add_subdirectory(FOLDER_TO_SDL   folder_to_my_bin_dir/SDL)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150110/ed715899/attachment.html>


More information about the CMake mailing list