Skip to content

Commit 3eb3981

Browse files
committed
Disabling setting CMAKE_FIND_LIBRARY_SUFFIXES on Apple platforms.
On macOS, since Big Sur, the libraries were moved to a cache. The SDK comes with stubs in the SDK (`/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/lib/` or whatever SDK version one has installed) where most have the `.tbd` suffix (although some still are `.a`). Forcing `CMAKE_FIND_LIBRARY_SUFFIXES` on Apple platforms broke building, unless one has copies of the libraries installed elsewhere (like Brew), as many libraries (like `iconv` or `pcre`) are not found. This fix disables setting the `CMAKE_FIND_LIBRARY_SUFFIXES` to `.a` if the platform is `APPLE` when building static libs.
1 parent 50b4d53 commit 3eb3981

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmake/DefaultCFlags.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ else()
9292
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")
9393
endif()
9494

95-
if(NOT BUILD_SHARED_LIBS)
95+
if(NOT APPLE AND NOT BUILD_SHARED_LIBS)
9696
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
9797
endif()
9898

0 commit comments

Comments
 (0)