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
| | ...
- Generate Xcode project by
mkdir build && cd build && cmake .. -GXcode
. - Then
pod init
and you will find that there is an error message aboutXcodeproj doesn't know about the following attributes...
, this scrpt will fix this error bypython3 strip_xcode.py -p test_pods.xcodeproj/project.pbxproj
. pod install
to install the dependencies, i.e. glfw3- 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 panelpath_to/test/Target Support Files/Pods-test_pods/Pods-test_pods.debug.xcconfig
, while the ture path ispath_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!