找不到cmake和osx框架

cmake and osx frameworks not found

本文关键字:框架 osx cmake 找不到      更新时间:2023-10-16

我正在做一些实验,处理C++、Android JNI和OSX平台提供的JavaScriptCore框架。

我在使用cmake加载JavascriptCore框架时遇到了一些问题。它似乎找不到它…

我的cmakelist中有以下代码:

find_library(JSCORE JavaScriptCore)
if (NOT JSCORE)
MESSAGE(ERROR ": Framework JSCore not found")
endif()

我总是路过。

我不知道为什么,我怀疑是路径问题。

有人知道或有一些建议,让我可以在我的C++库中加载JSCore框架吗?

感谢您的帮助

配置以下项目可以成功找到库。你能分享一个完整的例子吗?

cmake_minimum_required(VERSION 3.10)
project(Test)
find_library(JSCORE_LIBRARY JavaScriptCore)
if(NOT JSCORE_LIBRARY)
MESSAGE(FATAL_ERROR "Framework JSCore not found")
endif()
message(STATUS "JSCORE_LIBRARY: ${JSCORE_LIBRARY}")

输出:

$ /Volumes/Dashboards/Support/CMake-3.12.0.app/Contents/bin/cmake ../
-- The C compiler identification is AppleClang 8.0.0.8000042
-- The CXX compiler identification is AppleClang 8.0.0.8000042
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- [...]
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- JSCORE_LIBRARY: /System/Library/Frameworks/JavaScriptCore.framework
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/bld