From 307e9eb58fe98552b95ab493beb50b3170ad8e79 Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Wed, 9 Apr 2025 09:37:13 +0200
Subject: [PATCH] cmake - silence cmake warning

DEPENDS is not accepted for TARGET in add_custom_command (CMP0175)

Behavior in old cmake: just ignore DEPENDS
Behavior starting from cmake 3.30: warn
The fix: remove DEPENDS

TARGET form requires exactly one of PRE_BUILD, PRE_LINK or POST_BUILD to be given (CMP0175)

Behavior in old CMAKE: assume POST_BUILD
Behavior starting from cmake 3.30: assume POST_BUILD but warn
The fix: explicitely set POST_BUILD
---
 cmake_support/OST.cmake | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake
index f8f7c810..273cda3a 100644
--- a/cmake_support/OST.cmake
+++ b/cmake_support/OST.cmake
@@ -484,10 +484,9 @@ macro(compile_py_files module out_dir compiled_files_name)
     list(APPEND ${compiled_files_name} ${_out_file})
     get_filename_component(_in_name ${input_file} NAME)
     file(MAKE_DIRECTORY  ${out_dir})
-    add_custom_command(TARGET ${module}
+    add_custom_command(TARGET ${module} POST_BUILD
                        COMMAND ${Python_EXECUTABLE} -c "import py_compile;py_compile.compile(\"${_in_file}\",\"${_out_file}\",\"${_in_name}\",doraise=True)"
-                       VERBATIM DEPENDS ${input_file}
-                       )
+                       VERBATIM)
   endforeach()
 endmacro()
 
-- 
GitLab