summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorCraig Kolb <craig@kolb.net>2024-03-13 18:35:59 -0700
committerGitHub <noreply@github.com>2024-03-13 18:35:59 -0700
commit67704d0eee756be8647165ff2c73f1dc074874a2 (patch)
treefecc5aa2c8dbf043cf38d236e4f1e1f15450b735 /cmake
parente4b01c4ba53c40ff0704e72615422e5a96f636e3 (diff)
CMake fixes for MacOS (#3761)
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to '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 cb4443d0e..62c3c2a89 100644
--- a/cmake/SlangTarget.cmake
+++ b/cmake/SlangTarget.cmake
@@ -54,6 +54,8 @@ function(slang_add_target dir type)
EXTRA_COMPILE_DEFINITIONS_PUBLIC
# Targets with which to link privately
LINK_WITH_PRIVATE
+ # Frameworks with which to link privately
+ LINK_WITH_FRAMEWORK
# Targets whose headers we use, but don't link with
INCLUDE_FROM_PRIVATE
# Any include directories other targets need to use this target
@@ -208,6 +210,12 @@ function(slang_add_target dir type)
#
target_link_libraries(${target} PRIVATE ${ARG_LINK_WITH_PRIVATE})
+ if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ foreach(link_framework ${ARG_LINK_WITH_FRAMEWORK})
+ target_link_libraries(${target} PRIVATE "-framework ${link_framework}")
+ endforeach()
+ endif()
+
foreach(include_from ${ARG_INCLUDE_FROM_PRIVATE})
target_include_directories(
${target}