From: Markus Blatt <markus@dr-blatt.de>
Date: Sat, 28 Jan 2023 21:06:23 +0100
Subject: Make sure copy_python is run before CopyHeaders

CopyHeaders checks whether python/cxx exists in the build directory,
which is created by the copy_python target. Without this compilation
failed for serial builds because the python sources were not there when
we compiled.
---
 GenerateKeywords.cmake | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/GenerateKeywords.cmake b/GenerateKeywords.cmake
index 6401095..16a94c4 100644
--- a/GenerateKeywords.cmake
+++ b/GenerateKeywords.cmake
@@ -71,6 +71,7 @@ if (OPM_ENABLE_PYTHON)
   list(APPEND genkw_argv ${PROJECT_BINARY_DIR}/tmp_gen/builtin_pybind11.cpp)
   list(APPEND _tmp_output ${PROJECT_BINARY_DIR}/tmp_gen/builtin_pybind11.cpp)
   list(APPEND _target_output ${PROJECT_BINARY_DIR}/python/cxx/builtin_pybind11.cpp)
+  set(_python_depends copy_python)
 endif()
 
 add_custom_command( OUTPUT
@@ -81,5 +82,5 @@ add_custom_command( OUTPUT
 # To avoid some rebuilds
 add_custom_command(OUTPUT
   ${_target_output}
-  DEPENDS ${_tmp_output}
+  DEPENDS ${_tmp_output} ${_python_depends}
   COMMAND ${CMAKE_COMMAND} -DBASE_DIR=${PROJECT_BINARY_DIR} -P ${PROJECT_SOURCE_DIR}/CopyHeaders.cmake)
