From 3e72d97ca7d9fa4d130833d84108d08b92e97467 Mon Sep 17 00:00:00 2001 From: warptangent Date: Fri, 12 Feb 2016 11:32:37 -0800 Subject: [PATCH] cmake: Fix overly broad use of dynamic link settings Remove LINK_SEARCH_START_STATIC and LINK_SEARCH_END_STATIC. This is more appropriate when the compiler flag -static is used. This had been causing CMake to omit the linker flags necesssary to distinguish static and dynamic library linking. CMake had assumed static linking for the target, causing it to omit explicit static link flags. That is problematic without the -static compile flag being set. With a library located in system directories, like libboost_date_time, the full static path (.a), though found correctly by CMake, was treated by the linker as a dynamic library. This is because target_link_libraries() transforms the full path to -l if it's in a system directory. Without -static or explicit linker flags, the dynamic library (.so) is linked. Removing the above two properties removes the assumption of static. So -Wl;-Bstatic is inserted where needed. This causes -l to properly refer to the static library instead of dynamic. --- src/CMakeLists.txt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 036908f3..0ac4a0aa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -63,15 +63,6 @@ function (bitmonero_add_executable name) set_property(TARGET "${name}" PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") - - if (STATIC) - set_property(TARGET "${name}" - PROPERTY - LINK_SEARCH_START_STATIC 1) - set_property(TARGET "${name}" - PROPERTY - LINK_SEARCH_END_STATIC 1) - endif () endfunction () function (bitmonero_add_library name)