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})