Open DmitrySokolov opened 3 years ago
Patch for macOS and iOS:
--- conan.cmake
+++ conan.cmake
@@ -264,6 +264,13 @@
endif()
endforeach()
+ if(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang)
+ set(compile_options -isysroot ${CMAKE_SYSROOT} ${compile_options})
+ if(${CMAKE_SYSTEM_NAME} STREQUAL iOS)
+ set(compile_options ${compile_options} -target arm64-apple-ios${CMAKE_OSX_DEPLOYMENT_TARGET})
+ endif()
+ endif()
+
execute_process(
COMMAND ${CMAKE_COMMAND} -E echo "#include <string>"
COMMAND ${CMAKE_CXX_COMPILER} -x c++ ${compile_options} -E -dM -
Hi @DmitrySokolov, I think this should have already been fixed by https://github.com/conan-io/cmake-conan/pull/226 that is merged to develop and waiting to be release in 0.16, could you check if that PR fixed the issue? Thanks a lot
Nope. #226 fixes only macOS platform. iOS is still broken. Moreover, CMAKE_OSX_SYSROOT=iphoneos
for iOS, it's not a path to SDK.
1) The correct variable is CMAKE_SYSROOT
, but this single fix is not enough
2) Another mandatory option is -target ...
Hmm...
macOS reguires CMAKE_OSX_SYSROOT
, so the patch is
--- conan.cmake
+++ conan.cmake
@@ -264,6 +264,14 @@
endif()
endforeach()
+ if(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang)
+ if(${CMAKE_SYSTEM_NAME} STREQUAL iOS)
+ set(compile_options -isysroot ${CMAKE_SYSROOT} -target arm64-apple-ios${CMAKE_OSX_DEPLOYMENT_TARGET} ${compile_options})
+ else()
+ set(compile_options -isysroot ${CMAKE_OSX_SYSROOT} ${compile_options})
+ endif()
+ endif()
+
execute_process(
COMMAND ${CMAKE_COMMAND} -E echo "#include <string>"
COMMAND ${CMAKE_CXX_COMPILER} -x c++ ${compile_options} -E -dM -
Hi, hasn't it been merged?
The code
causes the following output
-isysroot
should be always specified for AppleClang, see also https://stackoverflow.com/a/63188875.Fix: