[cmake-developers] Safe source list GLOBs
Matthew Woehlke
matthew.woehlke at kitware.com
Thu May 30 11:50:06 EDT 2013
On 2013-05-30 08:47, Wojciech Knapik wrote:
> Working with make taught me once and for all, that functions like
> [execute_process] should be avoided whenever possible. A build tool
> creates files from files via the means of targets. So if you want to
> use a tool like this effectively, you should use targets to achieve
> your goals, otherwise unexpected things will happen.
That is true in most cases. However it is sometimes necessary, e.g. run
some tool to get its version string (because that information is not
otherwise available) in order to determine the correct install
destination for some files.
While add_custom_command is to be preferred in almost all cases, there
are definitely correct uses for execute_process, usually similar to uses
for e.g. try_compile (i.e. gathering system configuration information).
(Most recently, I am using it to parse a Shiboken typesystem XML to
determine the list of source files that will be created by binding
generation in order to feed them to add_library. This would be
impossible at build time short of using an external project.)
--
Matthew
More information about the cmake-developers
mailing list