Commit: cd8f2dfecc58604bb7a8bc342380e5236fbb4ba8
Author: Ray Molenkamp
Date:   Mon Feb 22 11:03:44 2021 -0700
Branches: master
https://developer.blender.org/rBcd8f2dfecc58604bb7a8bc342380e5236fbb4ba8

CMake/Windows: Detect Boost version

Rather than hardcoding the lib names, read
boosts version.hpp and extract the version
from there.

This will make it easier to land lib changes
in the near future.

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

M       build_files/cmake/platform/platform_win32.cmake

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

diff --git a/build_files/cmake/platform/platform_win32.cmake 
b/build_files/cmake/platform/platform_win32.cmake
index 06cee51344a..b303358d0b8 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -454,10 +454,18 @@ if(WITH_BOOST)
     set(BOOST ${LIBDIR}/boost)
     set(BOOST_INCLUDE_DIR ${BOOST}/include)
     set(BOOST_LIBPATH ${BOOST}/lib)
-    if(CMAKE_CL_64)
-      set(BOOST_POSTFIX "vc141-mt-x64-1_70.lib")
-      set(BOOST_DEBUG_POSTFIX "vc141-mt-gd-x64-1_70.lib")
+    set(BOOST_VERSION_HEADER ${BOOST_INCLUDE_DIR}/boost/version.hpp)
+    if(EXISTS ${BOOST_VERSION_HEADER})
+      file(STRINGS "${BOOST_VERSION_HEADER}" BOOST_LIB_VERSION REGEX "#define 
BOOST_LIB_VERSION ")
+      if(BOOST_LIB_VERSION MATCHES "#define BOOST_LIB_VERSION \"([0-9_]+)\"")
+        set(BOOST_VERSION "${CMAKE_MATCH_1}")
+      endif()
     endif()
+    if(NOT BOOST_VERSION)
+      message(FATAL_ERROR "Unable to determine Boost version")
+    endif()
+    set(BOOST_POSTFIX "vc141-mt-x64-${BOOST_VERSION}.lib")
+    set(BOOST_DEBUG_POSTFIX "vc141-mt-gd-x64-${BOOST_VERSION}.lib")
     set(BOOST_LIBRARIES
       optimized ${BOOST_LIBPATH}/libboost_date_time-${BOOST_POSTFIX}
       optimized ${BOOST_LIBPATH}/libboost_filesystem-${BOOST_POSTFIX}

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to