I have the following code in one of my CMakeLists.txt files: set(feature_files_h) set(feature_files_cpp)
macro(create_feature_files NAME) add_custom_command( OUTPUT ${FEATURES_OUTPUT_DIR}/${NAME}.cpp ${FEATURES_OUTPUT_DIR}/${NAME}.h DEPENDS ${FEATURES_INPUT_DIR}/${NAME}.txt WORKING_DIRECTORY ${SIM_ROOT}/tools/features COMMAND perl ${FEATURES_PERL_PATH} "-s${FEATURES_INPUT_DIR}" "-d${FEATURES_OUTPUT_DIR}" "-f${NAME}" ) list(APPEND feature_files_h ${FEATURES_OUTPUT_DIR}/${NAME}.h) list(APPEND feature_files_cpp ${FEATURES_OUTPUT_DIR}/${NAME}.cpp) endmacro() create_feature_files(example_features) create_feature_files(fme_core_features) create_feature_files(fme_features) create_feature_files(front_end_features) create_feature_files(inloop_filter_features) add_library(${PROJECT_NAME} STATIC ${feature_files_cpp} ${feature_files_h} ${SIM_ROOT}/tools/features/cpp-code/cfeatures.cpp) which creates a library from an existing source file called cfeatures.cpp and from a bunch of auto-generated .cpp and .h files. The whole thing works fine and runs the perl script to create each of the auto-generated files before creating the library. The only problem I have with it is that it is quite slow and I would like to speed it up by having it run the perl commands to create the auto-generated files in parallel. Currently, each of the auto-generated cpp files is generated sequentially, then they are all compiled in parallel and the library created in the final step. I'm using cmake 3.0.0 with Visual Studio 2013 Express Edition. And I've added the /MP option so that Visual Studio will do parallel builds. I've also set the "Projects and Solutions=>Build and Run=>maximum number of parallel project builds" option to 4. This works well with all the normal cpp files in other projects and I easily see all 4 cpu cores maxxed out. But when building this project only 1 cpu core is used. Can anybody tell me how to change it so that the auto-geneated files are created in parallel as well ? -- Glenn
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake