summaryrefslogtreecommitdiff
path: root/cmake/SlangTarget.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/SlangTarget.cmake')
-rw-r--r--cmake/SlangTarget.cmake8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmake/SlangTarget.cmake b/cmake/SlangTarget.cmake
index 07409a960..f02c860e4 100644
--- a/cmake/SlangTarget.cmake
+++ b/cmake/SlangTarget.cmake
@@ -65,6 +65,8 @@ function(slang_add_target dir type)
REQUIRED_BY
# Add a dependency to the new target on the specified targets
REQUIRES
+ # Add a dependency to the new target on the specified targets if they exist
+ OPTIONAL_REQUIRES
# Globs for any headers to install
PUBLIC_HEADERS
)
@@ -278,6 +280,12 @@ function(slang_add_target dir type)
add_dependencies(${target} ${ARG_REQUIRES})
endif()
+ foreach(required ${ARG_OPTIONAL_REQUIRES})
+ if(TARGET ${required})
+ add_dependencies(${target} ${required})
+ endif()
+ endforeach()
+
#
# Other preprocessor defines
#