【发布时间】:2020-05-06 20:17:50
【问题描述】:
使用 CLion IDE 和 CMake 用 c++ 和几个 Objective-c++ 类编译我的项目。
我的问题出现了,因为我需要在我的项目中包含 CoreFoundation,以便我的类在 .mm 文件中从 NSObject 继承
经过大量挖掘,我想我找到了将 MacOS 框架(CoreBluetooth、CoreFoundation 等)与 cmake 链接的现代 CMake 方式。
下面的代码是在我的 Cmakelists.txt 文件中查找和链接 MacOS 框架的现代方式:
target_link_libraries(project_name PUBLIC stdc++ "-framework CoreBluetooth"
"-framework Foundation"
"-framework CoreFoundation"
objc)
加载 cmake 不会引发任何错误,但是当我尝试 import 文件(在我的 .cpp 或 .mm 文件中)时,IDE 说它找不到 CoreBluetooth 和 Foundation 库。
不确定我是否遗漏了任何非常明显的东西。任何帮助将不胜感激!
【问题讨论】:
标签: c++ cmake clion core-foundation