summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorBernhard Guillon <Bernhard.Guillon@begu.org>2026-06-30 23:47:25 +0200
committerBernhard Guillon <Bernhard.Guillon@begu.org>2026-06-30 23:47:25 +0200
commit665524c0331cfc6eeab641dfd631aa69c109cd11 (patch)
tree845d1b650512fadc4e80f7d99ba19d9a13a444f8 /cmake
parent4f0d95c1ab0a6a9ed719cfe988bd17f7eda9a66a (diff)
downloadcsharp-cmake-665524c0331cfc6eeab641dfd631aa69c109cd11.tar.gz
csharp-cmake-665524c0331cfc6eeab641dfd631aa69c109cd11.zip
Add target validation to target_link_dotnet_libraries
Diffstat (limited to 'cmake')
-rw-r--r--cmake/dotnet.cmake15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/dotnet.cmake b/cmake/dotnet.cmake
index 9d03748..8782659 100644
--- a/cmake/dotnet.cmake
+++ b/cmake/dotnet.cmake
@@ -100,6 +100,21 @@ function(target_link_dotnet_libraries TARGET)
"" "" "${multiValueArgs}"
)
+ get_property(ALL_TARGETS GLOBAL PROPERTY DOTNET_TARGETS)
+ list(FIND ALL_TARGETS "${TARGET}" _idx)
+ if(_idx EQUAL -1)
+ message(FATAL_ERROR "target_link_dotnet_libraries: '${TARGET}' is not a dotnet target")
+ endif()
+
+ foreach(scope PUBLIC PRIVATE INTERFACE)
+ foreach(lib IN LISTS arg_${scope})
+ list(FIND ALL_TARGETS "${lib}" _idx)
+ if(_idx EQUAL -1)
+ message(FATAL_ERROR "target_link_dotnet_libraries: '${lib}' is not a dotnet target")
+ endif()
+ endforeach()
+ endforeach()
+
foreach(dep IN LISTS arg_NATIVE_DEPS)
get_property(CURRENT_NDEPS GLOBAL PROPERTY DOTNET_TARGET_${TARGET}_NATIVE_DEPS)
if(NOT CURRENT_NDEPS)