ios-cmake icon indicating copy to clipboard operation
ios-cmake copied to clipboard

[bug] Should set ENABLE_STRICT_TRY_COMPILE TRUE by default

Open halx99 opened this issue 3 years ago • 5 comments

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:

  1. 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

halx99 avatar Sep 09 '22 13:09 halx99

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

kambala-decapitator avatar Sep 12 '22 10:09 kambala-decapitator

Yes, If enable strict try compile, will be

-- Performing Test HAVE_LIBATOMIC - Fail

That's correct for ios don't needs libatomic.

halx99 avatar Sep 12 '22 11:09 halx99

this really depends on a concrete case. like I wrote in your PR, just pass -DENABLE_STRICT_TRY_COMPILE=ON to your configure command.

kambala-decapitator avatar Sep 12 '22 11:09 kambala-decapitator

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

halx99 avatar Sep 12 '22 11:09 halx99

Do your CMakeLists.txt perhaps set CMAKE_TRY_COMPILE_TARGET_TYPE (or TRY_COMPILE_TARGET_TYPE) to something else than STATIC_LIBRARY?

leetal avatar Oct 18 '22 09:10 leetal