From 1f0c5c107eaf3d789310971d0f95ab641da8d747 Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Thu, 7 Nov 2024 10:37:03 +0100 Subject: [PATCH] Fix race condition in CMake code. (#1555) The race is cause by the fact that two targets exist to copy the Python files. The first one because of `cpp_cc_build_time_copy` without `NO_TARGET`. The second because of the: add_custom_target(nmodl_copy_python_files ALL DEPENDS ...) The solution is to not create the per file target by passing `NO_TARGET` to `cpp_cc_build_time_copy`. --- src/pybind/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/CMakeLists.txt b/src/pybind/CMakeLists.txt index 25f80d1c1..b6a8b2318 100644 --- a/src/pybind/CMakeLists.txt +++ b/src/pybind/CMakeLists.txt @@ -99,7 +99,7 @@ file( foreach(file IN LISTS NMODL_PYTHON_FILES) cpp_cc_build_time_copy(INPUT ${NMODL_PROJECT_SOURCE_DIR}/python/nmodl/${file} OUTPUT - ${CMAKE_BINARY_DIR}/lib/nmodl/${file}) + ${CMAKE_BINARY_DIR}/lib/nmodl/${file} NO_TARGET) list(APPEND nmodl_python_binary_dir_files "${CMAKE_BINARY_DIR}/lib/nmodl/${file}") endforeach() add_custom_target(nmodl_copy_python_files ALL DEPENDS ${nmodl_python_binary_dir_files})