【问题标题】:cmake and osx frameworks not found找不到 cmake 和 osx 框架
【发布时间】:2018-08-06 13:49:40
【问题描述】:

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

我在使用 cmake 加载 JavascriptCore 框架时遇到了一些麻烦。好像找不到了……

我的 cmakelist 中有以下代码:

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

而且我总是通过它。

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

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

感谢您的帮助

【问题讨论】:

    标签: c++ cmake javascriptcore


    【解决方案1】:

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

    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
    

    【讨论】:

    • 当我在本地启动 cmake 时,构建工作正常。我当前的配置和 Android Studio + NDK/JNI + 编译 C++ 程序似乎有问题:o
    • 这里奇怪的是,如果我尝试使用 cmake 手动构建项目,我将拥有 javascriptcore 但没有 jni.h。当我尝试构建应用程序时,反之亦然使用Android Studio,找不到javascriptcore.h接口
    猜你喜欢
    • 2013-08-20
    • 1970-01-01
    • 2010-12-15
    • 1970-01-01
    • 1970-01-01
    • 2016-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多