You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a large mobile app project written in C++ (Qt) with many internal and external dependencies, as well as subprojects (Qt Creator), submodules and interconnections. For many years I’ve used qmake to generate Xcode project (with CocoaPods!), with many workarounds and hooks. I’ve decided to switch to cmake…
I’ve created many different CMakeLists for each subproject, dependency and 3rd party library in my project. Xcode project generates fine using cmake and CMakeLists, but a huge problem arises when I run pod install (CocoaPods).
Because I have subprojects and submodules, I also have many targets in Xcode (basically for each subproject/submodule — CMakeLists). That’s fine, because I have different versions of my app and can turn on/off modules etc. But some core modules need external CocoaPods (ex. Firebase)…
Here is the problem. Because I have many targets inside my Xcode project, I have to define targets to install CocoaPods. I can’t define CocoaPods for the whole project, because there is no abstract target.
target “app-core" do
project “my-app"
pod 'Firebase/Core'
pod 'Firebase/Messaging'
end
target "firebase-mlkit" do
project “my-app"
pod 'GoogleMLKit/BarcodeScanning'
end
For example, like this. After generating a pure Xcode project using cmake, I run pod install and generate a workspace. This workspace seems to be broken.
What did you expect to happen?
It opens fine, I can check all settings, all seems to be good, all schemas are there.. but the project cannot be built. I have ca. 20 submodules (targets), during compilation pretty all of them are compiling fine, but not the ones from Podfile! This is the problem.
For example, if I have only 2 targets in Podfile (like I mentioned before), each compilation I get
Link my-app
No such file or directory: '/Users/…../builds/my-app/app-core/Debug-iphonesimulator/libapp-core.a'
No such file or directory: '/Users/…../builds/my-app/3rdparty/firebase-mlkit/src/Debug-iphonesimulator/libfirebase-mlkit.a'
What happened instead?
So the Xcode cannot produce .a during this compilation. All other .a were compiled successfully. But! Those 2 targets (target “app-core" and target "firebase-mlkit”) do exist in Xcode Workspace, they can be chosen and observed! I can even receive errors from source code in this targets, so the compiler does "visit" those targets and tries to compile them!
I have to use CocoaPods, because Google doesn't support SPM.
All possible combinations of Podfile (no targets, all targets, abstract targets…) — it seems like cmake makes his own connections and settings that Podfile just breaks..
Many crazy hard-coded settings directly in Xcode — nothing helped.
File-difference betweet Xcode-projects on different stages - that's overkill.
Does anyone have any idea what could help in this situation? Why Xcode doesn't generate .a for the targets, that were changed with CocoaPods? Did I miss a setting, a path or an argument somewhere?
I've created a test CMake repository that clearly demonstrates this issue. Please refer to the repository linked below for a detailed view and reproducible example: https://github.com/noktius/cmake-cocoapods-example/
Report
What did you do?
I have a large mobile app project written in C++ (Qt) with many internal and external dependencies, as well as subprojects (Qt Creator), submodules and interconnections. For many years I’ve used
qmake
to generate Xcode project (with CocoaPods!), with many workarounds and hooks. I’ve decided to switch tocmake
…I’ve created many different CMakeLists for each subproject, dependency and 3rd party library in my project. Xcode project generates fine using
cmake
and CMakeLists, but a huge problem arises when I runpod install
(CocoaPods).Because I have subprojects and submodules, I also have many targets in Xcode (basically for each subproject/submodule — CMakeLists). That’s fine, because I have different versions of my app and can turn on/off modules etc. But some core modules need external CocoaPods (ex. Firebase)…
Here is the problem. Because I have many targets inside my Xcode project, I have to define targets to install CocoaPods. I can’t define CocoaPods for the whole project, because there is no abstract target.
For example, like this. After generating a pure Xcode project using
cmake
, I runpod install
and generate a workspace. This workspace seems to be broken.What did you expect to happen?
It opens fine, I can check all settings, all seems to be good, all schemas are there.. but the project cannot be built. I have ca. 20 submodules (targets), during compilation pretty all of them are compiling fine, but not the ones from
Podfile
! This is the problem.For example, if I have only 2 targets in Podfile (like I mentioned before), each compilation I get
What happened instead?
So the Xcode cannot produce
.a
during this compilation. All other.a
were compiled successfully. But! Those 2 targets (target “app-core" and target "firebase-mlkit”) do exist in Xcode Workspace, they can be chosen and observed! I can even receive errors from source code in this targets, so the compiler does "visit" those targets and tries to compile them!I have to use CocoaPods, because Google doesn't support SPM.
CocoaPods Environment
Stack
Installation Source
Plugins
Project that demonstrates the issue
Private project.
I’ve tried:
All possible combinations of
Podfile
(no targets, all targets, abstract targets…) — it seems like cmake makes his own connections and settings that Podfile just breaks..Many different suggestions from Google, like:
set(COCOAPODS_FRAMEWORK_SEARCH_PATHS "............/Pods/**")
set(CMAKE_XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS "${COCOAPODS_FRAMEWORK_SEARCH_PATHS}")
set_target_properties(firebase-mlkit PROPERTIES XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS "${COCOAPODS_FRAMEWORK_SEARCH_PATHS}")
set_target_properties(firebase-mlkit PROPERTIES XCODE_ATTRIBUTE_CONFIGURATION_BUILD_DIR "${BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)")
set_target_properties(firebase-mlkit PROPERTIES XCODE_ATTRIBUTE_LIBRARY_SEARCH_PATHS "${COCOAPODS_FRAMEWORK_SEARCH_PATHS}")
Many crazy hard-coded settings directly in Xcode — nothing helped.
File-difference betweet Xcode-projects on different stages - that's overkill.
Does anyone have any idea what could help in this situation? Why Xcode doesn't generate
.a
for the targets, that were changed withCocoaPods
? Did I miss a setting, a path or an argument somewhere?(cmake 3.29.0, Qt 6.7, Xcode 15.3, cocoapods 1.15.2)
The text was updated successfully, but these errors were encountered: