Use CMake provided library names on macOS
authorCharles Giessen <charles@lunarg.com>
Wed, 3 Nov 2021 21:09:32 +0000 (15:09 -0600)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Wed, 9 Mar 2022 22:06:30 +0000 (15:06 -0700)
The ${CMAKE_DL_LIBS} and Threads::Threads provides generic mechanisms to
use the dynamic linker and threading libraries on the system. In addition,
this commit replaces Vulkan::Headers with loader_specific_commits for the
vulkan-framework target. Note that this commit is in a series of commits and
not intended to work standalone.

loader/CMakeLists.txt

index 62333938d110763daee2163a3b2c6c6740ef7f02..31bbb1c3cb948398de5425dbb3972ac9abfb975d 100644 (file)
@@ -315,8 +315,8 @@ else()
             add_library(vulkan-framework SHARED ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS} ${FRAMEWORK_HEADERS})
         endif()
         add_dependencies(vulkan-framework loader_asm_gen_files)
-        target_link_libraries(vulkan-framework -ldl -lpthread -lm "-framework CoreFoundation")
-        target_link_libraries(vulkan-framework Vulkan::Headers)
+        target_link_libraries(vulkan-framework ${CMAKE_DL_LIBS} Threads::Threads -lm "-framework CoreFoundation")
+        target_link_libraries(vulkan-framework loader_specific_options)
 
         # The FRAMEWORK_VERSION needs to be "A" here so that Xcode code-signing works when a user adds their framework to an Xcode
         # project and does "Sign on Copy". It would have been nicer to use "1" to denote Vulkan 1. Although Apple docs say that a