summaryrefslogtreecommitdiffstats
path: root/cmake/SlangTarget.cmake
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-07-11 19:52:16 +0800
committerGitHub <noreply@github.com>2024-07-11 19:52:16 +0800
commit304f9f9a355ba543c767094c17f147e3845065fa (patch)
tree28f6e9e3ac389da8837eed24e5bf1759ff508cac /cmake/SlangTarget.cmake
parent055d4acd8c4d37a45b27e1333af96c203bec85e8 (diff)
More precise handing of option dependencies (#4612)
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
#