0

I've read this, this and this, but without any luck.
My problem was as title shown, the project was generated by CMake, here are the CMakeLists.txt, main.m and 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

step by step
My directory structure is

test
│ CMakeLists.txt
| main.m
└───build
| | strip_xcode.py
| | Podfile
| | Pods
| | test_pods.xcodeproj
| | test_pods.xcworkspace 
| | ...
  1. Generate Xcode project by mkdir build && cd build && cmake .. -GXcode.
  2. Then pod init and you will find that there is an error message about Xcodeproj doesn't know about the following attributes..., this scrpt will fix this error by python3 strip_xcode.py -p test_pods.xcodeproj/project.pbxproj.
  3. pod install to install the dependencies, i.e. glfw3
  4. you can ignore the message like ... target overrides the GCC_PREPROCESSOR_DEFINITIONS ...(we not focus on this), open test_pods.xcworkspace, in the left panel, go to test_pods -> Pods, click Pods-test_pods.debug.xcconfig, you will find that you can't open it. The full path will be shown in the right panel path_to/test/Target Support Files/Pods-test_pods/Pods-test_pods.debug.xcconfig, while the ture path is path_to/test/build/Pods/Target Support Files/Pods-test_pods/Pods-test_pods.debug.xcconfig. The folder build/Pods can't be recognized.

I think maybe there is something wrong with ${SRCROOT} or ${PODS_ROOT}? I google a lot but still can't fix my issue, any help will be appreciated!

coulsonwang
  • 161
  • 1
  • 11

1 Answers1

0

There was a bug in cocoapods which leads to incorrect install_dir handling in relative build environments. See https://github.com/CocoaPods/CocoaPods/issues/6268#issuecomment-443689964

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – 7uc1f3r Jul 15 '20 at 08:23