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<libname> 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<libname> to
properly refer to the static library instead of dynamic.
This commit is contained in:
warptangent 2016-02-12 11:32:37 -08:00
parent 24ccdb9b6e
commit 3e72d97ca7
No known key found for this signature in database
GPG key ID: 0E490BEBFBE4E92D

View file

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