aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2014-11-18 17:04:47 -0500
committerBen Boeckel <ben.boeckel@kitware.com>2014-11-18 17:04:47 -0500
commitce71c01f11fa27164d4681396f0ab0d97b04b400 (patch)
tree02c84140542de8e3bf13070f75c01342ad16e3db /CMakeLists.txt
parentmingw: copy required libraries to the build tree (diff)
downloadmonero-ce71c01f11fa27164d4681396f0ab0d97b04b400.tar.xz
cmake: work around a bug with implicit link directories
Unfortunately, this is necessary because CMake doesn't detect whether mingw libraries are static or shared and doesn't put a -static flag around the -lfoo argument which then makes the shared library be linked to.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3b517a8b..ebca5c6fb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -98,6 +98,14 @@ option(STATIC "Link libraries statically" ${DEFAULT_STATIC})
if(MINGW)
get_filename_component(msys2_install_path "[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MSYS2 64bit;InstallLocation]" ABSOLUTE)
set(CMAKE_INCLUDE_PATH "${msys2_install_path}/mingw64/include")
+ # This is necessary because otherwise CMake will make Boost libraries -lfoo
+ # rather than a full path. Unfortunately, this makes the shared libraries get
+ # linked due to a bug in CMake which misses putting -static flags around the
+ # -lfoo arguments.
+ list(REMOVE_ITEM CMAKE_C_IMPLICIT_LINK_DIRECTORIES
+ "${msys2_install_path}/mingw64/lib")
+ list(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES
+ "${msys2_install_path}/mingw64/lib")
endif()
if(STATIC)