[Bf-blender-cvs] [2a2ca3292a9] master: CMake: always unset CMAKE_REQUIRED_* variables after use

Campbell Barton noreply at git.blender.org
Thu Aug 18 02:01:41 CEST 2022


Commit: 2a2ca3292a93c224647c84916c09337ece661b5b
Author: Campbell Barton
Date:   Thu Aug 18 09:58:17 2022 +1000
Branches: master
https://developer.blender.org/rB2a2ca3292a93c224647c84916c09337ece661b5b

CMake: always unset CMAKE_REQUIRED_* variables after use

Always unset these variables after use as they could interfere with
other checks made afterwards.

===================================================================

M	build_files/cmake/platform/platform_unix.cmake
M	intern/ghost/CMakeLists.txt

===================================================================

diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index bfba89d3a13..f18638dfa6b 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -100,8 +100,8 @@ find_package_wrapper(Epoxy REQUIRED)
 function(check_freetype_for_brotli)
   include(CheckSymbolExists)
   set(CMAKE_REQUIRED_INCLUDES ${FREETYPE_INCLUDE_DIRS})
-  check_symbol_exists(FT_CONFIG_OPTION_USE_BROTLI
-  "freetype/config/ftconfig.h" HAVE_BROTLI)
+  check_symbol_exists(FT_CONFIG_OPTION_USE_BROTLI "freetype/config/ftconfig.h" HAVE_BROTLI)
+  unset(CMAKE_REQUIRED_INCLUDES)
   if(NOT HAVE_BROTLI)
     unset(HAVE_BROTLI CACHE)
     message(FATAL_ERROR "Freetype needs to be compiled with brotli support!")
@@ -957,6 +957,7 @@ function(CONFIGURE_ATOMIC_LIB_IF_NEEDED)
 
     set(CMAKE_REQUIRED_LIBRARIES atomic)
     check_cxx_source_compiles("${_source}" ATOMIC_OPS_WITH_LIBATOMIC)
+    unset(CMAKE_REQUIRED_LIBRARIES)
 
     if(ATOMIC_OPS_WITH_LIBATOMIC)
       set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -latomic" PARENT_SCOPE)
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 099785bafa8..d59c179e371 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -288,6 +288,7 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
     include(CheckSymbolExists)
     set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
     check_symbol_exists(memfd_create "sys/mman.h" HAVE_MEMFD_CREATE)
+    unset(CMAKE_REQUIRED_DEFINITIONS)
     if(HAVE_MEMFD_CREATE)
       add_definitions(-DHAVE_MEMFD_CREATE)
     endif()



More information about the Bf-blender-cvs mailing list