想整理一个库的cmake工程,他用

cmake+ninja

简单了解了一下,是可以不依赖Android studio编译的cmake的,搜到了一个cmake+ninja,参考[1]

案例

参考[1]中的代码

背景

  • cmake我是已经安装的了
  • ninja我打算直接用Android SDK里面的

结果说ninja不对

重新安装ninja

  • 下载,参考[2]
  • 设置环境变量

编译通过

参考[3]的例子更加简单,然后就顺利编译过了

F:\study\compile\cmake\cmake_ninja_1\build>cmake .. -G Ninja
-- The C compiler identification is Clang 16.0.0 with GNU-like command-line
-- The CXX compiler identification is Clang 16.0.0 with GNU-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/ProgramFiles/LLVM/bin/clang.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: D:/ProgramFiles/LLVM/bin/clang++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (2.0s)
-- Generating done (0.0s)
-- Build files have been written to: F:/study/compile/cmake/cmake_ninja_1/build

参考

[1]案例代码来源
[2]ninja下载
[3]更简单的一个案例

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部