【发布时间】:2020-07-15 15:51:39
【问题描述】:
我读过this、this 和this,但没有任何运气。
我的问题如标题所示,项目是由 CMake 生成的,这里是 CMakeLists.txt、main.m 和 Podfile
#CMakeLists.txt
cmake_minimum_required(VERSION 3.6)
set(target_name test_pods)
project(${target_name})
add_executable(${target_name} main.m)
//main.m
#import "glfw3.h"
int main(int argc, const char * argv[]) {
if(!glfwInit())
return 1;
return 0;
}
#Podfile
platform :osx, '10.14'
target 'test_pods' do
# Pods for test_pods
pod 'CCGlfw'
end
一步一步
我的目录结构是
test
│ CMakeLists.txt
| main.m
└───build
| | strip_xcode.py
| | Podfile
| | Pods
| | test_pods.xcodeproj
| | test_pods.xcworkspace
| | ...
- 通过
mkdir build && cd build && cmake .. -GXcode生成Xcode项目。
- 然后
pod init你会发现有一个关于Xcodeproj doesn't know about the following attributes...的错误信息,这个scrpt会通过python3 strip_xcode.py -p test_pods.xcodeproj/project.pbxproj修复这个错误。
-
pod install安装依赖,即 glfw3
- 你可以忽略
... target overrides the GCC_PREPROCESSOR_DEFINITIONS ...之类的消息(我们不关注这个),打开test_pods.xcworkspace,在左侧面板中,进入test_pods -> Pods ,点击Pods-test_pods.debug.xcconfig,会发现打不开。完整路径将显示在右侧面板中path_to/test/Target Support Files/Pods-test_pods/Pods-test_pods.debug.xcconfig,而真正的路径是path_to/test/build/Pods/Target Support Files/Pods-test_pods/Pods-test_pods.debug.xcconfig。 build/Pods 文件夹无法识别。
我认为${SRCROOT} 或${PODS_ROOT} 可能有问题?我google了很多,但仍然无法解决我的问题,任何帮助将不胜感激!
【问题讨论】: