diff options
author | mj-xmr <mjxmr@protonmail.com> | 2021-03-02 09:50:20 +0100 |
---|---|---|
committer | mj-xmr <mjxmr@protonmail.com> | 2021-04-24 09:45:51 +0200 |
commit | b4fe7c24013c86a59087ae7f0dfe9875c794f5be (patch) | |
tree | fd630df9ebc42359bf7c9ccfba225a32dd3e957b | |
parent | Merge pull request #7669 (diff) | |
download | monero-b4fe7c24013c86a59087ae7f0dfe9875c794f5be.tar.xz |
epee linkage dynamic; move monero_add_library to main CMakeLists.txt
-rw-r--r-- | CMakeLists.txt | 23 | ||||
-rw-r--r-- | contrib/epee/src/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/CMakeLists.txt | 24 |
3 files changed, 27 insertions, 27 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e858b3aaf..17ba7516f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -526,6 +526,29 @@ macro (monero_enable_coverage) endif() endmacro() +function (monero_add_library name) + monero_add_library_with_deps(NAME "${name}" SOURCES ${ARGN}) +endfunction() + +function (monero_add_library_with_deps) + cmake_parse_arguments(MONERO_ADD_LIBRARY "" "NAME" "DEPENDS;SOURCES" ${ARGN}) + source_group("${MONERO_ADD_LIBRARY_NAME}" FILES ${MONERO_ADD_LIBRARY_SOURCES}) + + # Define a ("virtual") object library and an actual library that links those + # objects together. The virtual libraries can be arbitrarily combined to link + # any subset of objects into one library archive. This is used for releasing + # libwallet, which combines multiple components. + set(objlib obj_${MONERO_ADD_LIBRARY_NAME}) + add_library(${objlib} OBJECT ${MONERO_ADD_LIBRARY_SOURCES}) + add_library("${MONERO_ADD_LIBRARY_NAME}" $<TARGET_OBJECTS:${objlib}>) + monero_set_target_no_relink("${MONERO_ADD_LIBRARY_NAME}") + if (MONERO_ADD_LIBRARY_DEPENDS) + add_dependencies(${objlib} ${MONERO_ADD_LIBRARY_DEPENDS}) + endif() + set_property(TARGET "${MONERO_ADD_LIBRARY_NAME}" PROPERTY FOLDER "libs") + target_compile_definitions(${objlib} + PRIVATE $<TARGET_PROPERTY:${MONERO_ADD_LIBRARY_NAME},INTERFACE_COMPILE_DEFINITIONS>) +endfunction () # Generate header for embedded translations # Generate header for embedded translations, use target toolchain if depends, otherwise use the diff --git a/contrib/epee/src/CMakeLists.txt b/contrib/epee/src/CMakeLists.txt index 368f49c95..b4cc7aa8a 100644 --- a/contrib/epee/src/CMakeLists.txt +++ b/contrib/epee/src/CMakeLists.txt @@ -34,7 +34,7 @@ file(GLOB EPEE_HEADERS_PUBLIC "${EPEE_INCLUDE_DIR_BASE}/**/*.h*" # Any number of subdirs will be included. ) -add_library(epee STATIC byte_slice.cpp byte_stream.cpp hex.cpp abstract_http_client.cpp http_auth.cpp mlog.cpp net_helper.cpp net_utils_base.cpp string_tools.cpp +monero_add_library(epee byte_slice.cpp byte_stream.cpp hex.cpp abstract_http_client.cpp http_auth.cpp mlog.cpp net_helper.cpp net_utils_base.cpp string_tools.cpp wipeable_string.cpp levin_base.cpp memwipe.c connection_basic.cpp network_throttle.cpp network_throttle-detail.cpp mlocker.cpp buffer.cpp net_ssl.cpp int-util.cpp portable_storage.cpp misc_language.cpp @@ -47,7 +47,7 @@ add_library(epee STATIC byte_slice.cpp byte_stream.cpp hex.cpp abstract_http_cli ) if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW))) - add_library(epee_readline STATIC readline_buffer.cpp) + monero_add_library(epee_readline readline_buffer.cpp) endif() if(HAVE_C11) @@ -75,8 +75,9 @@ target_link_libraries(epee ${Boost_CHRONO_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} - PRIVATE + ${Boost_REGEX_LIBRARY} ${OPENSSL_LIBRARIES} + PRIVATE ${EXTRA_LIBRARIES}) if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW))) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9904c5de7..1f89faf98 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -79,30 +79,6 @@ function (monero_add_executable name) monero_set_target_no_relink("${name}") endfunction () -function (monero_add_library name) - monero_add_library_with_deps(NAME "${name}" SOURCES ${ARGN}) -endfunction() - -function (monero_add_library_with_deps) - cmake_parse_arguments(MONERO_ADD_LIBRARY "" "NAME" "DEPENDS;SOURCES" ${ARGN}) - source_group("${MONERO_ADD_LIBRARY_NAME}" FILES ${MONERO_ADD_LIBRARY_SOURCES}) - - # Define a ("virtual") object library and an actual library that links those - # objects together. The virtual libraries can be arbitrarily combined to link - # any subset of objects into one library archive. This is used for releasing - # libwallet, which combines multiple components. - set(objlib obj_${MONERO_ADD_LIBRARY_NAME}) - add_library(${objlib} OBJECT ${MONERO_ADD_LIBRARY_SOURCES}) - add_library("${MONERO_ADD_LIBRARY_NAME}" $<TARGET_OBJECTS:${objlib}>) - monero_set_target_no_relink("${MONERO_ADD_LIBRARY_NAME}") - if (MONERO_ADD_LIBRARY_DEPENDS) - add_dependencies(${objlib} ${MONERO_ADD_LIBRARY_DEPENDS}) - endif() - set_property(TARGET "${MONERO_ADD_LIBRARY_NAME}" PROPERTY FOLDER "libs") - target_compile_definitions(${objlib} - PRIVATE $<TARGET_PROPERTY:${MONERO_ADD_LIBRARY_NAME},INTERFACE_COMPILE_DEFINITIONS>) -endfunction () - include(Version) monero_add_library(version SOURCES ${CMAKE_BINARY_DIR}/version.cpp DEPENDS genversion) |