-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake with Xcode and CocoaPods - compile problem #12333
Comments
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/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: