Details
-
Bug
-
Resolution: Done
-
P2: Important
-
6.0.1, 6.1.0 RC, 6.2.3, 6.3.0
-
None
-
MacOS to iOS compilation using Qt Creator or cmake on command line
-
-
c0188b2dbd (qt/qtbase/dev) c0188b2dbd (qt/tqtc-qtbase/dev) b5254073fd (qt/qtbase/6.3) b5254073fd (qt/tqtc-qtbase/6.3) b5254073fd (qt/qtbase/6.3.1)
Description
Doing this in CMakeLists.txt
add_library(untitled4 ${PROJECT_SOURCES}) [...] qt_add_executable(untitled4Standalone [...]) [...] target_link_libraries(untitled4Standalone PRIVATE untitled4)
Fails with
clang: error: no such file or directory: '/Users/tomana/build-untitled4-Qt_6_0_2_for_iOS/Debug/libuntitled4.a'
The actual target location of untitled4 is "/Users/tomana/build-untitled4-Qt_6_0_2_for_iOS/Debug_-iphoneos_/libuntitled4.a".
A workaround for this issue is adding the macro:
macro(ios_fix_lib_build_folder TARGET) if(IOS AND XCODE) set_target_properties(${TARGET} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_DEBUG "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/") set_target_properties(${TARGET} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELEASE "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/") set_target_properties(${TARGET} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/") set_target_properties(${TARGET} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/") endif()endmacro()
And then calling it like this:
add_library(untitled4 ${PROJECT_SOURCES}) ios_fix_lib_build_folder(untitled4) [...] qt_add_executable(untitled4Standalone [...]) [...] target_link_libraries(untitled4Standalone PRIVATE untitled4)
(macro taken from here: https://www.reddit.com/r/Xcode/comments/bgkez2/debugiphonesimulator_vs_debug_problems_with/)
This happens both when deploying using Qt Creator 4.15.0 rc-1 or calling cmake from command line using `cmake -GXcode -DCMAKE_PREFIX_PATH:STRING=/Users/username/Qt/6.1.0/ios -DCMAKE_TOOLCHAIN_FILE:PATH=/Users/username/Qt/6.1.0/ios/lib/cmake/Qt6/qt.toolchain.cmake -DCMAKE_OSX_ARCHITECTURES:STRING=arm64 -DCMAKE_OSX_SYSROOT:STRING=iphoneos -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM:STRING=*** -S . -B build; cmake --build build`
When compiling a Qt application using Qt 5.15.2 for iOS using the community toolchain https://github.com/leetal/ios-cmake this does not happen. I've not been able to figure out how the ios-cmake project resolves this (and they do not use the macro above, I believe.)
Should this issue be resolved in the qt ios toolchains, perhaps?
Attachments
Issue Links
- is duplicated by
-
QTBUG-96169 QtSensors: Grue example doesn't compile with cmake on iOS
- Reported
- is required for
-
QTBUG-95838 Improve experience of building iOS projects with CMake
- Closed
- relates to
-
QTBUG-95381 CMake library install target does not copy binaries on iOS
- Closed
-
QTBUG-102595 Builds can't find the projects qml modules
- Closed
- resulted from
-
QTBUG-87198 Configuring example targeting iOS with CMake + Xcode generator fails
- Closed
- mentioned in
-
Page Loading...