diff options
author | Ankit Meel <ankitjmeel@gmail.com> | 2020-10-16 11:05:58 +0300 |
---|---|---|
committer | Ankit Meel <ankitjmeel@gmail.com> | 2020-10-16 11:11:29 +0300 |
commit | bb872b25f219d1a9bc2446228b6dc7a9248d7f20 (patch) | |
tree | 2d3f4901aebfe44c0e601d9fc65d078a56722155 /build_files/cmake | |
parent | 3ffe65a7fb990836ae389289ae9bd7a675fea980 (diff) |
CMake/macOS: Search for headers in Frameworks last.
https://devtalk.blender.org/t/libpng-version-mismatch/15799/
By default, `CMAKE_FIND_FRAMEWORK` is `FIRST`.
CMake searches headers and libraries separately. So library is found
in LIBDIR, and headers like those in Mono are detected before the
headers in LIBDIR, and we get a version mismatch.
So set the priority of Frameworks to `LAST`.
https://gitlab.kitware.com/cmake/cmake/-/issues/18921
https://gitlab.kitware.com/cmake/cmake/-/issues/16427
{rBbac91956ae97} tried to fix the same issue, but it didn't work.
It's fine to keep the changes made there, just removing the comment
that may give false sense of security.
Diffstat (limited to 'build_files/cmake')
-rw-r--r-- | build_files/cmake/macros.cmake | 8 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_apple.cmake | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index a3f3feeaaa2..e75505e9885 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -1241,8 +1241,16 @@ endmacro() macro(without_system_libs_begin) set(CMAKE_IGNORE_PATH "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES};${CMAKE_SYSTEM_INCLUDE_PATH};${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES};${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}") + if(APPLE) + # Avoid searching for headers in frameworks (like Mono), and libraries in LIBDIR. + set(CMAKE_FIND_FRAMEWORK LAST) + endif() endmacro() macro(without_system_libs_end) unset(CMAKE_IGNORE_PATH) + if(APPLE) + # FIRST is the default. + set(CMAKE_FIND_FRAMEWORK FIRST) + endif() endmacro() diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake index f755c70a859..36e6d71bfb2 100644 --- a/build_files/cmake/platform/platform_apple.cmake +++ b/build_files/cmake/platform/platform_apple.cmake @@ -227,8 +227,6 @@ if(WITH_SDL) set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -framework ForceFeedback") endif() -# Use CMP0074 for our benefit. Stop CMake from searching libraries in one -# place and headers in another. set(PNG_ROOT ${LIBDIR}/png) find_package(PNG REQUIRED) |