[Bf-blender-cvs] [bb872b25f21] master: CMake/macOS: Search for headers in Frameworks last.
Ankit Meel
noreply at git.blender.org
Fri Oct 16 10:13:11 CEST 2020
Commit: bb872b25f219d1a9bc2446228b6dc7a9248d7f20
Author: Ankit Meel
Date: Fri Oct 16 13:35:58 2020 +0530
Branches: master
https://developer.blender.org/rBbb872b25f219d1a9bc2446228b6dc7a9248d7f20
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.
===================================================================
M build_files/cmake/macros.cmake
M build_files/cmake/platform/platform_apple.cmake
===================================================================
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)
More information about the Bf-blender-cvs
mailing list