From a87ce0946192ab6ea3668298565a24bf66724691 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Oct 2014 13:33:26 -0400 Subject: cmake: factor out error messages Instead of using BoldRed and ColourReset everywhere, wrap it up in a function. --- CMakeLists.txt | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 78e4b426f..f729c4217 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,11 +30,18 @@ cmake_minimum_required(VERSION 2.8.6) -if(NOT WIN32) - string(ASCII 27 Esc) - set(ColourReset "${Esc}[m") - set(BoldRed "${Esc}[1;31m") -endif() +function (die msg) + if (NOT WIN32) + string(ASCII 27 Esc) + set(ColourReset "${Esc}[m") + set(BoldRed "${Esc}[1;31m") + else () + set(ColourReset "") + set(BoldRed "") + endif () + + message(FATAL_ERROR "${BoldRed}${msg}${ColourReset}") +endfunction () set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") @@ -204,11 +211,11 @@ endif() find_package(Boost 1.53 QUIET REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options) if(NOT Boost_FOUND) - MESSAGE(FATAL_ERROR "${BoldRed}Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.53 or 1.55+) or the equivalent${ColourReset}") + die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.53 or 1.55+) or the equivalent") endif() if((${Boost_MAJOR_VERSION} EQUAL 1) AND (${Boost_MINOR_VERSION} EQUAL 54)) - message(FATAL_ERROR "${BoldRed}Boost version 1.54 is unsupported due to a bug (see: http://goo.gl/RrCFmA), please install Boost 1.53 or 1.55 and above${ColourReset}") + die("Boost version 1.54 is unsupported due to a bug (see: http://goo.gl/RrCFmA), please install Boost 1.53 or 1.55 and above") endif() include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) -- cgit v1.2.3 From a43f1a88d8018e98d7389c23598e9292a5635305 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Oct 2014 13:38:21 -0400 Subject: cmake: remove configuration variables CMAKE_BUILD_TYPE is meant for single-config build tools (e.g., make and ninja) while CMAKE_CONFIGURATION_TYPES is meant for multi-config build tools (e.g., Xcode and Visual Studio). They should not be mixed or manually set. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index f729c4217..903648bcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,7 +61,6 @@ message(STATUS "BOOST_IGNORE_SYSTEM_PATHS defaults to ${BOOST_IGNORE_SYSTEM_PATH option(BOOST_IGNORE_SYSTEM_PATHS "Ignore boost system paths for local boost ins tallation" $BOOST_IGNORE_SYSTEM_PATHS_DEFAULT) set_property(GLOBAL PROPERTY USE_FOLDERS ON) -set(CMAKE_CONFIGURATION_TYPES "Debug;Release") enable_testing() # Check if we're on FreeBSD so we can exclude the local miniupnpc (it should be installed from ports instead) -- cgit v1.2.3 From eeffac6839431cec45c8d7e798b6ae42e6a0817c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Oct 2014 13:41:10 -0400 Subject: cmake: fix up BOOST_IGNORE_SYSTEM_PATHS The option was set twice when it only needs to be set once. Also fix a bogus dereference and spurious whitespace. --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 903648bcc..ac5cc395a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,14 +51,13 @@ if (NOT DEFINED ENV{DEVELOPER_LOCAL_TOOLS}) elseif ("$ENV{DEVELOPER_LOCAL_TOOLS}" EQUAL 1) message(STATUS "Found: env DEVELOPER_LOCAL_TOOLS = 1") set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT ON) - option(BOOST_IGNORE_SYSTEM_PATHS "Ignore boost system paths for local boost installation" ON) else() message(STATUS "found: env DEVELOPER_LOCAL_TOOLS = 0") set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT OFF) endif() message(STATUS "BOOST_IGNORE_SYSTEM_PATHS defaults to ${BOOST_IGNORE_SYSTEM_PATHS_DEFAULT}") -option(BOOST_IGNORE_SYSTEM_PATHS "Ignore boost system paths for local boost ins tallation" $BOOST_IGNORE_SYSTEM_PATHS_DEFAULT) +option(BOOST_IGNORE_SYSTEM_PATHS "Ignore boost system paths for local boost installation" ${BOOST_IGNORE_SYSTEM_PATHS_DEFAULT}) set_property(GLOBAL PROPERTY USE_FOLDERS ON) enable_testing() -- cgit v1.2.3 From eba180a1c786c4a86ead7e46f6e19febef4dd940 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Oct 2014 13:52:24 -0400 Subject: cmake: support git info in released tarballs --- CMakeLists.txt | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index ac5cc395a..bdb347191 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,17 +228,7 @@ elseif(NOT MSVC) set(EXTRA_LIBRARIES ${RT} ${PTHREAD} ${DL}) endif() -file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/version") -find_package(Git QUIET) -if(Git_FOUND OR GIT_FOUND) - message(STATUS "Found Git: ${GIT_EXECUTABLE}") - add_custom_target(version ALL "${CMAKE_COMMAND}" "-D" "GIT=${GIT_EXECUTABLE}" "-D" "TO=${CMAKE_BINARY_DIR}/version/version.h" "-P" "src/version.cmake" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") -else() - message(STATUS "WARNING: Git was not found!") - set(VERSIONTAG "unknown") - configure_file("src/version.h.in" "version/version.h") - add_custom_target(version ALL) -endif() +include(version.cmake) add_subdirectory(src) add_subdirectory(tests) -- cgit v1.2.3 From c24d22b44e1c6a0c30c7e85da9e828810141f313 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Oct 2014 14:17:32 -0400 Subject: cmake: clean up if auto-dereferencing CMake will auto-dereference variable names in if statements, so there's no need to dereference them manually. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index bdb347191..35dd132ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") if (NOT DEFINED ENV{DEVELOPER_LOCAL_TOOLS}) message(STATUS "Could not find DEVELOPER_LOCAL_TOOLS in env (not required)") set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT OFF) -elseif ("$ENV{DEVELOPER_LOCAL_TOOLS}" EQUAL 1) +elseif (ENV{DEVELOPER_LOCAL_TOOLS} EQUAL 1) message(STATUS "Found: env DEVELOPER_LOCAL_TOOLS = 1") set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT ON) else() @@ -130,7 +130,7 @@ if(MSVC) include_directories(SYSTEM src/platform/msc) else() set(ARCH native CACHE STRING "CPU to build for: -march value or default") - if("${ARCH}" STREQUAL "default") + if(ARCH STREQUAL "default") set(ARCH_FLAG "") else() set(ARCH_FLAG "-march=${ARCH}") @@ -212,7 +212,7 @@ if(NOT Boost_FOUND) die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.53 or 1.55+) or the equivalent") endif() -if((${Boost_MAJOR_VERSION} EQUAL 1) AND (${Boost_MINOR_VERSION} EQUAL 54)) +if((Boost_MAJOR_VERSION EQUAL 1) AND (Boost_MINOR_VERSION EQUAL 54)) die("Boost version 1.54 is unsupported due to a bug (see: http://goo.gl/RrCFmA), please install Boost 1.53 or 1.55 and above") endif() -- cgit v1.2.3 From 799e8b241fc4c049434c825a2a3d4f74d34d0ada Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Oct 2014 14:20:26 -0400 Subject: cmake: use option() for STATIC --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 35dd132ef..52835da84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,7 +90,7 @@ if(MSVC OR MINGW) else() set(DEFAULT_STATIC false) endif() -set(STATIC ${DEFAULT_STATIC} CACHE BOOL "Link libraries statically") +option(STATIC "Link libraries statically" ${DEFAULT_STATIC}) IF(STATIC) IF(MSVC) -- cgit v1.2.3 From 475fe209a8a18657796b7c694f4bfb298ce2aa95 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Oct 2014 14:24:49 -0400 Subject: cmake: minor cleanups (indentation and typos) --- CMakeLists.txt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 52835da84..1f57f8ca0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,14 +46,14 @@ endfunction () set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") if (NOT DEFINED ENV{DEVELOPER_LOCAL_TOOLS}) - message(STATUS "Could not find DEVELOPER_LOCAL_TOOLS in env (not required)") - set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT OFF) + message(STATUS "Could not find DEVELOPER_LOCAL_TOOLS in env (not required)") + set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT OFF) elseif (ENV{DEVELOPER_LOCAL_TOOLS} EQUAL 1) - message(STATUS "Found: env DEVELOPER_LOCAL_TOOLS = 1") - set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT ON) + message(STATUS "Found: env DEVELOPER_LOCAL_TOOLS = 1") + set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT ON) else() - message(STATUS "found: env DEVELOPER_LOCAL_TOOLS = 0") - set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT OFF) + message(STATUS "Found: env DEVELOPER_LOCAL_TOOLS = 0") + set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT OFF) endif() message(STATUS "BOOST_IGNORE_SYSTEM_PATHS defaults to ${BOOST_IGNORE_SYSTEM_PATHS_DEFAULT}") @@ -92,13 +92,13 @@ else() endif() option(STATIC "Link libraries statically" ${DEFAULT_STATIC}) -IF(STATIC) - IF(MSVC) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll.a .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - ELSE() - SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - ENDIF() -ENDIF() +if(STATIC) + if(MSVC) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll.a .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() +endif() if (UNIX AND NOT APPLE) # Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail @@ -175,7 +175,7 @@ else() # There is a clang bug that does not allow to compile code that uses AES-NI intrinsics if -flto is enabled, so explicitly disable if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(USE_LTO false) + set(USE_LTO false) endif() if(USE_LTO) set(RELEASE_FLAGS "${RELEASE_FLAGS} -flto") @@ -199,7 +199,7 @@ else() endif() if (BOOST_IGNORE_SYSTEM_PATHS) - set(Boost_NO_SYSTEM_PATHS TRUE) + set(Boost_NO_SYSTEM_PATHS TRUE) endif() if(STATIC) -- cgit v1.2.3 From abbd5c0bdb5541aa8c75beea9e8a119297b6d76f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 21 Oct 2014 18:39:15 -0400 Subject: unbound: import cmake build system --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f57f8ca0..d9dff16ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,6 +117,7 @@ endif() # Final setup for libunbound include_directories(${UNBOUND_INCLUDE}) +link_directories(${UNBOUND_LIBRARY_DIRS}) if(MSVC) add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__") -- cgit v1.2.3 From 0f0efc4af221edca19cdcbba5f80b140c58f855e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 22 Oct 2014 15:17:52 -0400 Subject: cmake: prepend to CMAKE_MODULE_PATH --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index d9dff16ec..5cbf92e98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,8 @@ function (die msg) message(FATAL_ERROR "${BoldRed}${msg}${ColourReset}") endfunction () -set (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +list(INSERT CMAKE_MODULE_PATH 0 + "${CMAKE_SOURCE_DIR}/cmake") if (NOT DEFINED ENV{DEVELOPER_LOCAL_TOOLS}) message(STATUS "Could not find DEVELOPER_LOCAL_TOOLS in env (not required)") -- cgit v1.2.3 From 3b7bdcb7908bed79937cb34b4ec2ebe74f192857 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 23 Oct 2014 14:03:54 -0400 Subject: cmake: set the project name --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cbf92e98..26a9ba8fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,8 @@ cmake_minimum_required(VERSION 2.8.6) +project(bitmonero) + function (die msg) if (NOT WIN32) string(ASCII 27 Esc) -- cgit v1.2.3 From 9689df925c7e1b3291ad2f351136fee5f383f527 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 23 Oct 2014 14:04:08 -0400 Subject: cmake: clean up EXTRA_LIBRARIES pthread is handled by CMAKE_THREAD_LIBS_INIT while libdl isn't needed. --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 26a9ba8fb..7dcb36d85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,13 +222,11 @@ endif() include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) if(MINGW) - set(EXTRA_LIBRARIES pthread;mswsock;ws2_32) + set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi) elseif(APPLE OR FREEBSD) set(EXTRA_LIBRARIES "") elseif(NOT MSVC) find_library(RT rt) - find_library(PTHREAD pthread) - find_library(DL dl) set(EXTRA_LIBRARIES ${RT} ${PTHREAD} ${DL}) endif() -- cgit v1.2.3 From 7d708e422397fb0ba8ac29855eb27964115e7217 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 24 Oct 2014 14:48:14 -0400 Subject: cmake: support 2.8.7 Older versions of CMake support LINK_{PUBLIC,PRIVATE} while newer versions prefer PUBLIC and PRIVATE instead, but still support the LINK_ prefix. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dcb36d85..75b7bf60f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ # # Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers -cmake_minimum_required(VERSION 2.8.6) +cmake_minimum_required(VERSION 2.8.7) project(bitmonero) -- cgit v1.2.3 From 475154255ace3212087b9b3492c1cd8e51bfde61 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 17 Nov 2014 18:09:21 -0500 Subject: msys: look in msys' directory for files This tells find_path and find_library to look under this directory first which is what we want on msys2. --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 75b7bf60f..b8bc83a07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,11 @@ else() endif() 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") +endif() + if(STATIC) if(MSVC) set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll.a .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) -- cgit v1.2.3 From 5680c9cac7725ad265eb01336f80366a2dfddce3 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 17 Nov 2014 18:10:07 -0500 Subject: msys: factor out -Werror on msys There are Windows-related warnings turned into errors here. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index b8bc83a07..43d03a879 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,7 +144,10 @@ else() else() set(ARCH_FLAG "-march=${ARCH}") endif() - set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Werror -Wno-error=extra -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized") + set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized") + if(NOT MINGW) + set(WARNINGS "${WARNINGS} -Werror") + endif() if(CMAKE_C_COMPILER_ID STREQUAL "Clang") set(WARNINGS "${WARNINGS} -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration") else() -- cgit v1.2.3 From 18c56abe4bf5d069abe9ee44442cbbb859f845f5 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 17 Nov 2014 18:10:52 -0500 Subject: msys: don't use LTO This causes duplicate symbol errors on msys' mingw install. --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 43d03a879..f3b517a8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,6 +158,8 @@ else() set(MINGW_FLAG "${MINGW_FLAG} -DWIN32_LEAN_AND_MEAN") set(Boost_THREADAPI win32) include_directories(SYSTEM src/platform/mingw) + # mingw doesn't support LTO (multiple definition errors at link time) + set(USE_LTO_DEFAULT false) endif() set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes") set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers") -- cgit v1.2.3 From ce71c01f11fa27164d4681396f0ab0d97b04b400 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 18 Nov 2014 17:04:47 -0500 Subject: 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. --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'CMakeLists.txt') 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) -- cgit v1.2.3