[CMake] How to make the construction and reuse of CMake lists safer?

SF Markus Elfring elfring at users.sourceforge.net
Mon Sep 22 11:50:52 EDT 2014


Hello,

The build tool "CMake" supports also the data processing for lists to some degree.
http://www.cmake.org/cmake/help/v3.0/manual/cmake-language.7.html#lists

I notice that CMake scripts are also provided by some software libraries so that
corresponding settings can be automatically determined by the command
"find_package".
http://www.cmake.org/cmake/help/v3.0/command/find_package.html

I have also noticed that a lot of libraries provide only a single file for
source file inclusion and linking. It seems that appropriate quoting of
variables is often forgotten for this use case, isn't it?

How many library build scripts construct variables with suffixes like
"_INCLUDE_DIRS" and "_LIBRARIES" which contain two list elements at least?

Can any special build function help to make the required data processing safer here?
How can it be achieved that contents are properly escaped?

Regards,
Markus


More information about the CMake mailing list