hello,

My build step is not thread-safe (the instruction in the COMMAND part). Every build step depends on one source file:


/add_custom_command(//
//        DEPENDS on_source.file//
//        OUTPUT//
//                object_file_for_source_file//
//        COMMAND not-thread-safe-compiler --build on_source.file//
//        COMMENT//
//                "Building Source object"//
//)/


add_custom_target DEPENDS on OUTPUT from all custom command's, but in order to prevent parallel execution when cmake is called:


/cmake --build . --target all -j30/


I need to build each step in any order, but still not as a dependency as this would trigger unnecessary recompilation. Using MAIN_DEPENDENCY defines hierarchical dependency, but this won't help in this situation.


I cannot figure out how to prevent parallel execution of COMMAND in CMake. The only option I see is a single command


/add_custom_target(tgt//
//        DEPENDS on_all_source.files//
//        COMMAND not-thread-safe-compiler --build on_source1.file/

/        COMMAND not-thread-safe-compiler --build on_source2.file/

/        COMMAND not-thread-safe-compiler --build on_source3.file/

/        . . .//
/

/        COMMENT//
//                "Building target"//
//)/


this would rebuild every source, though.


How do I set this up?


thank you

-- 

Powered by kitware.com/cmake

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit https://cmake.org/services

Visit other Kitware open-source projects at https://www.kitware.com/platforms

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

This mailing list is deprecated in favor of https://discourse.cmake.org

Reply via email to