更改 Xcode 编译 C 程序的方式?

问题描述

我使用 (raylib) 的库说用我可以运行的 xcode 编译程序

cc yourgame.c `pkg-config --libs --cflags raylib`

我知道我可以从终端运行它并且它工作得很好,但是我如何将它放入 Xcode 以便我可以按下播放按钮? 抱歉,如果我用错了措辞,我还在学习中。

解决方法

事先找到标志。将它们添加到变量 OTHER_LDFLAGS 中的链接标志。

最好的方法是使用 cmake。

// CmakeLists.txt
project(test)
add_executable(foo yourgame.cc)
// Find link flags using Cmake's find pkg module.
add_link_options(link_flags_found_above)

然后运行 ​​cmake path/to/CmakeLists.txt -G Xcode

https://cmake.org/cmake/help/latest/module/FindPkgConfig.html

看看其他人可能如何在 GitHub 上使用它。