Feature idea: Parallel command blocks
I feel like there is big possibility to improve CMake performance by adding some kind of parallelism to language.
First thing which happens when you call
cmake .. is
-- Performing Test ... -- Checking support ... -- Looking for ...
And it takes up to few minutes. And this is only the first use that comes to mind, but for sure community would find more of it. (Parallel
git clone for
I have not done any research how much effort would it take to implement parallelism neither to develop strict API for it.
My simplest API idea is to provide functions
end_parallel_block, in which every command is run parallelly, e.g.:
start_parallel_block(WORKERS 4) LA_CHECK_INCLUDE_FILE("linux/magic.h" HAVE_LINUX_MAGIC_H) LA_CHECK_INCLUDE_FILE("locale.h" HAVE_LOCALE_H) LA_CHECK_INCLUDE_FILE("membership.h" HAVE_MEMBERSHIP_H) LA_CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H) LA_CHECK_INCLUDE_FILE("paths.h" HAVE_PATHS_H) LA_CHECK_INCLUDE_FILE("poll.h" HAVE_POLL_H) end_parallel_blocks()
Setting same variable by two different workers would be prohibited to prevent any races (and need for synchronisation objects). I suppose same about directory/target's properties.
I've opened this issue to ask whenever similar idea have been tried to be implemented already? Or is there maybe some technical reason why it is a bad idea?