Link the Mac Framework File with CMake
Contents
While writing program on Mac, sometimes we need to link framework and libraries under OSX folder System/Library/Frameworks. There are so many frameworks like CoreMedia & VideoToolBox, which you will use in FFMpeg or something else someday.
In this situation, we have to use find_library as it includes some special handling for frameworks on OSX.
Also, don’t use link_directories, CMake use full paths to libraries and it’s not needed.
Here’s some simple example with CoreMedia:
find_library(CORE_MEDIA CoreMedia) if (NOT CORE_MEDIA) message(FATAL_ERROR “CoreMedia not found”) endif()
add_executable(program ${program_SOURCES}) target_link_libraries(program ${CORE_MEDIA})
Author Watterry
LastMod 2016-08-12