[Bf-blender-cvs] [98c74c6a6ec] master: Fix: Excessive (re)builds of subprojects

Ray Molenkamp noreply at git.blender.org
Mon Mar 2 20:42:06 CET 2020


Commit: 98c74c6a6ec40655e3db462bd4e1335588a10546
Author: Ray Molenkamp
Date:   Mon Mar 2 12:42:01 2020 -0700
Branches: master
https://developer.blender.org/rB98c74c6a6ec40655e3db462bd4e1335588a10546

Fix: Excessive (re)builds of subprojects

Recent refactor external dependencies handling (D6642)
improperly linked all library dependencies with public
linkage rather than interface linkage. Causing excessive
(re)builds of subprojects when not needed.

This patch restores the interface linkage.

Reviewed By: brecht sergey

Differential Revision: https://developer.blender.org/D6983

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

M	build_files/cmake/macros.cmake
M	source/blender/usd/CMakeLists.txt

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

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index d082e6e9503..cb45d30c664 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -122,7 +122,7 @@ function(target_link_libraries_optimized
   )
 
   foreach(_LIB ${LIBS})
-    target_link_libraries(${TARGET} optimized "${_LIB}")
+    target_link_libraries(${TARGET} INTERFACE optimized "${_LIB}")
   endforeach()
 endfunction()
 
@@ -132,7 +132,7 @@ function(target_link_libraries_debug
   )
 
   foreach(_LIB ${LIBS})
-    target_link_libraries(${TARGET} debug "${_LIB}")
+    target_link_libraries(${TARGET} INTERFACE debug "${_LIB}")
   endforeach()
 endfunction()
 
@@ -303,11 +303,11 @@ function(blender_add_lib__impl
         set(next_library_mode "${library_lower}")
       else()
         if("${next_library_mode}" STREQUAL "optimized")
-          target_link_libraries(${name} optimized ${library})
+          target_link_libraries(${name} INTERFACE optimized ${library})
         elseif("${next_library_mode}" STREQUAL "debug")
-          target_link_libraries(${name} debug ${library})
+          target_link_libraries(${name} INTERFACE debug ${library})
         else()
-          target_link_libraries(${name} ${library})
+          target_link_libraries(${name} INTERFACE ${library})
         endif()
         set(next_library_mode "")
       endif()
diff --git a/source/blender/usd/CMakeLists.txt b/source/blender/usd/CMakeLists.txt
index 6ea02f44d76..0bcc0e6069e 100644
--- a/source/blender/usd/CMakeLists.txt
+++ b/source/blender/usd/CMakeLists.txt
@@ -97,13 +97,13 @@ endif()
 
 # Source: https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives
 if(WIN32)
-  target_link_libraries(bf_usd ${USD_LIBRARIES})
+  target_link_libraries(bf_usd INTERFACE ${USD_LIBRARIES})
 elseif(CMAKE_COMPILER_IS_GNUCXX)
-  target_link_libraries(bf_usd "-Wl,--whole-archive ${USD_LIBRARIES} -Wl,--no-whole-archive ${TBB_LIBRARIES}")
+  target_link_libraries(bf_usd INTERFACE "-Wl,--whole-archive ${USD_LIBRARIES} -Wl,--no-whole-archive ${TBB_LIBRARIES}")
 elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
-  target_link_libraries(bf_usd  -Wl,-force_load ${USD_LIBRARIES})
+  target_link_libraries(bf_usd INTERFACE -Wl,-force_load ${USD_LIBRARIES})
 else()
   message(FATAL_ERROR "Unknown how to link USD with your compiler ${CMAKE_CXX_COMPILER_ID}")
 endif()
 
-target_link_libraries(bf_usd ${TBB_LIBRARIES})
+target_link_libraries(bf_usd INTERFACE ${TBB_LIBRARIES})



More information about the Bf-blender-cvs mailing list