Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Molenkamp <github@lazydodo.com>2022-03-25 19:15:11 +0300
committerRay Molenkamp <github@lazydodo.com>2022-03-25 19:15:11 +0300
commit2631b44e719b8b74dc9c166caf855491169b054f (patch)
treedb758d1eb3ed2fc0494de675944e94948af9e4ef /source/blender/io
parent19bcfba56fdaf11eab08a56deeec89e427a3fd0d (diff)
MSVC: Fix linker issue with USD
USD requires to be linked with /WHOLEARCHIVE so the linker won't remove their static initializers. This strangely has never worked for MSVC since the flags were set on the LINK_FLAGS property which is only used to link .dll and .exe files, given this is a static lib, the flags were not used, nor did CMake propagate the link directive to the final targets that did link. Not quite sure how this has not lead to more problems in the past. Setting the link directive on the INTERFACE_LINK_OPTIONS makes cmake do the right thing. Differential Revision: https://developer.blender.org/D14394 Reviewed by: sybren
Diffstat (limited to 'source/blender/io')
-rw-r--r--source/blender/io/usd/CMakeLists.txt8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/io/usd/CMakeLists.txt b/source/blender/io/usd/CMakeLists.txt
index 01d0cfcd302..2b5ea39617e 100644
--- a/source/blender/io/usd/CMakeLists.txt
+++ b/source/blender/io/usd/CMakeLists.txt
@@ -107,10 +107,10 @@ list(APPEND LIB
blender_add_lib(bf_usd "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
if(WIN32)
- set_property(TARGET bf_usd APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /WHOLEARCHIVE:${USD_DEBUG_LIB}")
- set_property(TARGET bf_usd APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /WHOLEARCHIVE:${USD_RELEASE_LIB}")
- set_property(TARGET bf_usd APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO " /WHOLEARCHIVE:${USD_RELEASE_LIB}")
- set_property(TARGET bf_usd APPEND_STRING PROPERTY LINK_FLAGS_MINSIZEREL " /WHOLEARCHIVE:${USD_RELEASE_LIB}")
+ set_property(TARGET bf_usd APPEND_STRING PROPERTY INTERFACE_LINK_OPTIONS "$<$<CONFIG:Debug>:/WHOLEARCHIVE:${USD_DEBUG_LIB}>")
+ set_property(TARGET bf_usd APPEND_STRING PROPERTY INTERFACE_LINK_OPTIONS "$<$<CONFIG:Release>:/WHOLEARCHIVE:${USD_RELEASE_LIB}>")
+ set_property(TARGET bf_usd APPEND_STRING PROPERTY INTERFACE_LINK_OPTIONS "$<$<CONFIG:RelWithDebInfo>:/WHOLEARCHIVE:${USD_RELEASE_LIB}>")
+ set_property(TARGET bf_usd APPEND_STRING PROPERTY INTERFACE_LINK_OPTIONS "$<$<CONFIG:MinSizeRel>:/WHOLEARCHIVE:${USD_RELEASE_LIB}>")
endif()
# Source: https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives