diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt index c8e6219f5e..24d865d0f5 100644 --- a/cmd/CMakeLists.txt +++ b/cmd/CMakeLists.txt @@ -37,8 +37,16 @@ foreach(CMD ${HEADLESS_CMD_SRCS}) add_cmd(${CMD} FALSE) endforeach(CMD) +# mrregister and mrtransform are the commands that take the longest to compile +# so we try to start their compilation as soon as possible by adding them as dependencies +# of a generated dummy file (which Ninja prioritises during compilation). +# This is hacky, but it increases build parallelism. +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "int main(){}") +add_executable(0_dummy ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp) +add_dependencies(0_dummy mrregister mrtransform) + if(MRTRIX_BUILD_GUI) foreach(CMD ${GUI_CMD_SRCS}) add_cmd(${CMD} TRUE) endforeach(CMD) -endif() \ No newline at end of file +endif()