[Bf-blender-cvs] [f3f5207e426] temp-precompiled-cmake: CMake: Add macros for ignoring system libs

Nathan Craddock noreply at git.blender.org
Fri Feb 21 06:10:53 CET 2020


Commit: f3f5207e42611f2816eca3adaf0076a6aa440e1d
Author: Nathan Craddock
Date:   Thu Feb 20 22:09:14 2020 -0700
Branches: temp-precompiled-cmake
https://developer.blender.org/rBf3f5207e42611f2816eca3adaf0076a6aa440e1d

CMake: Add macros for ignoring system libs

Start adding new macros to ignore system libraries when building with
precompiled libraries on Linux.

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

M	build_files/cmake/macros.cmake
M	build_files/cmake/platform/platform_unix.cmake

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

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 2ae641b9eb3..622fc42def8 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -1167,3 +1167,10 @@ macro(set_and_warn_dependency
     endif()
 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}")
+endmacro()
+
+macro(without_system_libs_end)
+  unset(CMAKE_IGNORE_PATH)
+endmacro()
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index ac570f17e47..6adfb1bbf70 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -104,17 +104,21 @@ if(WITH_PYTHON)
 endif()
 
 if(WITH_IMAGE_OPENEXR)
+  without_system_libs_begin()
   find_package_wrapper(OpenEXR)  # our own module
   if(NOT OPENEXR_FOUND)
     set(WITH_IMAGE_OPENEXR OFF)
   endif()
+  without_system_libs_end()
 endif()
 
 if(WITH_IMAGE_OPENJPEG)
+  without_system_libs_begin()
   find_package_wrapper(OpenJPEG)
   if(NOT OPENJPEG_FOUND)
     set(WITH_IMAGE_OPENJPEG OFF)
   endif()
+  without_system_libs_end()
 endif()
 
 if(WITH_IMAGE_TIFF)
@@ -298,6 +302,7 @@ if(WITH_USD)
 endif()
 
 if(WITH_BOOST)
+  without_system_libs_begin()
   # uses in build instructions to override include and library variables
   if(NOT BOOST_CUSTOM)
     if(WITH_STATIC_LIBS)
@@ -345,9 +350,11 @@ if(WITH_BOOST)
     find_package(IcuLinux)
     list(APPEND BOOST_LIBRARIES ${ICU_LIBRARIES})
   endif()
+  without_system_libs_end()
 endif()
 
 if(WITH_OPENIMAGEIO)
+  without_system_libs_begin()
   find_package_wrapper(OpenImageIO)
   if(NOT OPENIMAGEIO_PUGIXML_FOUND AND WITH_CYCLES_STANDALONE)
     find_package_wrapper(PugiXML)
@@ -377,6 +384,7 @@ if(WITH_OPENIMAGEIO)
     set(WITH_OPENIMAGEIO OFF)
     message(STATUS "OpenImageIO not found, disabling WITH_CYCLES")
   endif()
+  without_system_libs_end()
 endif()
 
 if(WITH_OPENCOLORIO)



More information about the Bf-blender-cvs mailing list