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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2020-01-16 14:57:58 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2020-01-17 11:21:18 +0300
commit554f861ac11a308e3f00f1cd55d4c9e76015b7ad (patch)
tree8a324039a88a0cb71cbfd50ab93f3c37babb7397 /build_files/cmake/macros.cmake
parent6b7e5b35bcbfbd603573bff5761347d4bf0bda2a (diff)
Build: fix Linux linking errors with some combinations of build options
Differential Revision: https://developer.blender.org/D6600
Diffstat (limited to 'build_files/cmake/macros.cmake')
-rw-r--r--build_files/cmake/macros.cmake19
1 files changed, 19 insertions, 0 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 3b6b4720a7c..3fe9ae90a79 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -416,6 +416,17 @@ function(setup_liblinks
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${PLATFORM_LINKFLAGS_RELEASE}" PARENT_SCOPE)
+ # Work around undefined reference errors when disabling certain libraries.
+ # Finding the right order for all combinations of options is too hard, so
+ # we use --start-group and --end-group so the linker does not discard symbols
+ # too early. This appears to have no significant performance impact.
+ if(UNIX AND NOT APPLE)
+ target_link_libraries(
+ ${target}
+ -Wl,--start-group
+ )
+ endif()
+
# jemalloc must be early in the list, to be before pthread (see T57998)
if(WITH_MEM_JEMALLOC)
target_link_libraries(${target} ${JEMALLOC_LIBRARIES})
@@ -592,6 +603,14 @@ function(setup_liblinks
# target_link_libraries(${target} ${PLATFORM_LINKLIBS} ${CMAKE_DL_LIBS})
target_link_libraries(${target} ${PLATFORM_LINKLIBS})
+
+ # See comments above regarding --start-group.
+ if(UNIX AND NOT APPLE)
+ target_link_libraries(
+ ${target}
+ -Wl,--end-group
+ )
+ endif()
endfunction()
macro(TEST_SSE_SUPPORT