ios-cmake
ios-cmake copied to clipboard
[bug] Should set ENABLE_STRICT_TRY_COMPILE TRUE by default
Describe the bug
Sets ENABLE_STRICT_TRY_COMPILE OFF default, will lead cmake generate incorrect native project for dynamic libraries.
To Reproduce Steps to reproduce the behavior:
- https://github.com/axys1/axys/runs/8269974724?check_suite_focus=true
Expected behavior Generate native project correct when build dynamic library on iOS.
Environment
- What version of CMake did you run?
- Your faulty CMakeLists.txt here:
git clone https://github.com/kcat/openal-soft
cd openal-soft
cmake -B build -GXcode -DCMAKE_TOOLCHAIN_FILE=ios.cmake.toolchain -DPLATFORM=OS64
cmake --build build --target OpenAL
# will error with: ld: library not found for -latomic, because the openal-soft find non-exists library `libatomic` with this toolchain file
your build log doesn't contain exact linker command, you should build without -quiet.
Also, in configure step there's
-- Performing Test HAVE_LIBATOMIC - Success
Yes, If enable strict try compile, will be
-- Performing Test HAVE_LIBATOMIC - Fail
That's correct for ios don't needs libatomic.
this really depends on a concrete case. like I wrote in your PR, just pass -DENABLE_STRICT_TRY_COMPILE=ON to your configure command.
Yes, your solution can solve the this issue, but I don't known why ios-cmake set ENABLE_STRICT_TRY_COMPILE to OFF by default.
For more detail, you can refer to: https://github.com/kcat/openal-soft/pull/466
Do your CMakeLists.txt perhaps set CMAKE_TRY_COMPILE_TARGET_TYPE (or TRY_COMPILE_TARGET_TYPE) to something else than STATIC_LIBRARY?