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 -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers