【问题标题】:Can't find *.xcconfig in cmake generated project after pod installpod install 后在 cmake 生成的项目中找不到 *.xcconfig
【发布时间】:2020-07-15 15:51:39
【问题描述】:

我读过thisthisthis,但没有任何运气。
我的问题如标题所示,项目是由 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 
| | ...
  1. 通过mkdir build && cd build && cmake .. -GXcode生成Xcode项目。
  2. 然后pod init你会发现有一个关于Xcodeproj doesn't know about the following attributes...的错误信息,这个scrpt会通过python3 strip_xcode.py -p test_pods.xcodeproj/project.pbxproj修复这个错误。
  3. pod install 安装依赖,即 glfw3
  4. 你可以忽略... 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.xcconfigbuild/Pods 文件夹无法识别。

我认为${SRCROOT}${PODS_ROOT} 可能有问题?我google了很多,但仍然无法解决我的问题,任何帮助将不胜感激!

【问题讨论】:

    标签: xcode cmake cocoapods


    【解决方案1】:

    cocoapods 中存在一个错误,导致相关构建环境中的 install_dir 处理不正确。见https://github.com/CocoaPods/CocoaPods/issues/6268#issuecomment-443689964

    【讨论】:

    • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接的答案可能会失效。
    猜你喜欢
    • 1970-01-01
    • 2015-01-08
    • 1970-01-01
    • 2012-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多