aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/cmake/data
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-02-23 12:49:50 +0200
committerGitHub <noreply@github.com>2020-02-23 12:49:50 +0200
commitbacf063aaeb4f739c93b056a9a6c8ae4c731cd95 (patch)
tree7c62d7dbf33591cec0ba13e22edfce54397dfefb /mesonbuild/cmake/data
parent00c9a7a43060c215ebd3fe6e15233cd8ebc90bc7 (diff)
parent113ec96626fe7cd2edc0bc4815ae2fc21cfb0546 (diff)
downloadmeson-bacf063aaeb4f739c93b056a9a6c8ae4c731cd95.zip
meson-bacf063aaeb4f739c93b056a9a6c8ae4c731cd95.tar.gz
meson-bacf063aaeb4f739c93b056a9a6c8ae4c731cd95.tar.bz2
Merge pull request #6635 from mensinda/cmOTMFix
cmake: Fix dependency loops in custom targets (fixes #6632)
Diffstat (limited to 'mesonbuild/cmake/data')
-rw-r--r--mesonbuild/cmake/data/preload.cmake35
1 files changed, 35 insertions, 0 deletions
diff --git a/mesonbuild/cmake/data/preload.cmake b/mesonbuild/cmake/data/preload.cmake
new file mode 100644
index 0000000..30178fb
--- /dev/null
+++ b/mesonbuild/cmake/data/preload.cmake
@@ -0,0 +1,35 @@
+if(MESON_PS_LOADED)
+ return()
+endif()
+
+set(MESON_PS_LOADED ON)
+
+# Dummy macros that have a special meaning in the meson code
+macro(meson_ps_execute_delayed_calls)
+endmacro()
+
+macro(meson_ps_reload_vars)
+endmacro()
+
+# Helper macro to inspect the current CMake state
+macro(meson_ps_inspect_vars)
+ set(MESON_PS_CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+ set(MESON_PS_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+ meson_ps_execute_delayed_calls()
+endmacro()
+
+
+# Override some system functions with custom code and forward the args
+# to the original function
+macro(add_custom_command)
+ meson_ps_inspect_vars()
+ _add_custom_command(${ARGV})
+endmacro()
+
+macro(add_custom_target)
+ meson_ps_inspect_vars()
+ _add_custom_target(${ARGV})
+endmacro()
+
+set(MESON_PS_DELAYED_CALLS add_custom_command;add_custom_target)
+meson_ps_reload_vars()