diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2021-06-10 11:18:26 -0500 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2021-06-10 11:18:26 -0500 |
| commit | 25bbb26f63d085ea033ed5084d588a6742f0543c (patch) | |
| tree | 668609ba36555ca090507d4f48d9393f5a3d5211 /CMakeLists.txt | |
| parent | 1c8e598172bd2eddba2607cae0804db2e685813b (diff) | |
| parent | b4fe7c24013c86a59087ae7f0dfe9875c794f5be (diff) | |
| download | monzero-core-25bbb26f63d085ea033ed5084d588a6742f0543c.tar.gz monzero-core-25bbb26f63d085ea033ed5084d588a6742f0543c.tar.xz monzero-core-25bbb26f63d085ea033ed5084d588a6742f0543c.zip | |
Merge pull request #7416
b4fe7c2 epee linkage dynamic; move monero_add_library to main CMakeLists.txt (mj-xmr)
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cf8131a0..7d5c62cf0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -540,6 +540,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 |
