Boost: Use static libs

This commit is contained in:
Paweł Bylica 2017-08-17 11:56:49 +02:00
parent 397a72107a
commit 0712e6302e
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
2 changed files with 3 additions and 54 deletions

View File

@ -43,60 +43,9 @@ find_program(CTEST_COMMAND ctest)
## use multithreaded boost libraries, with -mt suffix
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ON)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# use static boost libraries *.lib
set(Boost_USE_STATIC_LIBS ON)
elseif (APPLE)
# use static boost libraries *.a
set(Boost_USE_STATIC_LIBS ON)
elseif (UNIX)
# use dynamic boost libraries *.dll
set(Boost_USE_STATIC_LIBS OFF)
endif()
set(STATIC_LINKING FALSE CACHE BOOL "Build static binaries")
if (STATIC_LINKING)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
set(OpenSSL_USE_STATIC_LIBS ON)
if (MSVC)
# TODO - Why would we need .a on Windows? Maybe some Cygwin-ism.
# When I work through Windows static linkage, I will remove this,
# if that is possible.
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
elseif (APPLE)
# At the time of writing, we are still only PARTIALLY statically linked
# on OS X, with a mixture of statically linked external libraries where
# those are available, and dynamically linked where that is the only
# option we have. Ultimately, the aim would be for everything except
# the runtime libraries to be statically linked.
#
# Still TODO:
# - jsoncpp
# - json-rpc-cpp
# - leveldb (which pulls in snappy, for the dylib at ;east)
# - miniupnp
# - gmp
#
# Two further libraries (curl and zlib) ship as dylibs with the platform
# but again we could build from source and statically link these too.
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib)
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif()
endif()
find_package(Boost 1.54.0 QUIET REQUIRED COMPONENTS thread date_time system regex chrono filesystem unit_test_framework program_options random)
find_package(Boost 1.54.0 QUIET REQUIRED COMPONENTS regex filesystem unit_test_framework program_options)
eth_show_dependency(Boost boost)

View File

@ -2,7 +2,7 @@ file(GLOB sources "*.cpp")
file(GLOB headers "*.h")
add_library(devcore ${sources} ${headers})
target_link_libraries(devcore PRIVATE ${Boost_FILESYSTEM_LIBRARIES} ${Boost_SYSTEM_LIBRARIES})
target_link_libraries(devcore PRIVATE ${Boost_FILESYSTEM_LIBRARIES} ${Boost_REGEX_LIBRARIES} ${Boost_SYSTEM_LIBRARIES})
target_include_directories(devcore SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
target_include_directories(devcore PRIVATE ..)
add_dependencies(devcore solidity_BuildInfo.h)