CMake MacOS Framework link

MacOS Frameworks are linked with the -framework flag. CMake has special handling for these flags, so target_link_libraries should be used for them. The quoting in the example below is necessary to get CMake handling the flags correctly.

add_executable(main main.c)

  target_link_libraries(main PRIVATE
  "-framework Foundation"
  "-framework IOKit"

Alternatively, use find_library() with the framework name.