cmake: refactor common code with libraries

This commit is contained in:
Ben Boeckel 2014-10-21 11:24:14 -04:00
parent c773f465ca
commit 55ca7d3b34
7 changed files with 18 additions and 51 deletions

View file

@ -56,6 +56,18 @@ function (bitmonero_add_executable name)
endif () endif ()
endfunction () endfunction ()
function (bitmonero_add_library name)
source_group("${name}"
FILES
${ARGN})
add_library("${name}"
${ARGN})
set_property(TARGET "${name}"
PROPERTY
FOLDER "libs")
endfunction ()
add_subdirectory(common) add_subdirectory(common)
add_subdirectory(crypto) add_subdirectory(crypto)
add_subdirectory(cryptonote_core) add_subdirectory(cryptonote_core)

View file

@ -43,12 +43,7 @@ set(common_headers
util.h util.h
varint.h) varint.h)
source_group(common bitmonero_add_library(common
FILES
${common_sources}
${common_headers})
add_library(common
${common_sources} ${common_sources}
${common_headers}) ${common_headers})
target_link_libraries(common target_link_libraries(common
@ -59,6 +54,3 @@ target_link_libraries(common
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}
${EXTRA_LIBRARIES}) ${EXTRA_LIBRARIES})
set_property(TARGET common
PROPERTY
FOLDER "libs")

View file

@ -66,14 +66,6 @@ set(crypto_headers
skein.h skein.h
skein_port.h) skein_port.h)
source_group(crypto bitmonero_add_library(crypto
FILES
${crypto_sources} ${crypto_sources}
${crypto_headers}) ${crypto_headers})
add_library(crypto
${crypto_sources}
${crypto_headers})
set_property(TARGET crypto
PROPERTY
FOLDER "libs")

View file

@ -58,12 +58,7 @@ set(cryptonote_core_headers
tx_pool.h tx_pool.h
verification_context.h) verification_context.h)
source_group(cryptonote_core bitmonero_add_library(cryptonote_core
FILES
${cryptonote_core_sources}
${cryptonote_core_headers})
add_library(cryptonote_core
${cryptonote_core_sources} ${cryptonote_core_sources}
${cryptonote_core_headers}) ${cryptonote_core_headers})
target_link_libraries(cryptonote_core target_link_libraries(cryptonote_core
@ -78,6 +73,3 @@ target_link_libraries(cryptonote_core
${Boost_SYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY} ${Boost_THREAD_LIBRARY}
${EXTRA_LIBRARIES}) ${EXTRA_LIBRARIES})
set_property(TARGET cryptonote_core
PROPERTY
FOLDER "libs")

View file

@ -39,12 +39,7 @@ set(mnemonics_headers
singleton.h singleton.h
spanish.h) spanish.h)
source_group(mnemonics bitmonero_add_library(mnemonics
FILES
${mnemonics_sources}
${mnemonics_headers})
add_library(mnemonics
${mnemonics_sources} ${mnemonics_sources}
${mnemonics_headers}) ${mnemonics_headers})
target_link_libraries(mnemonics target_link_libraries(mnemonics

View file

@ -34,12 +34,7 @@ set(rpc_headers
core_rpc_server_commands_defs.h core_rpc_server_commands_defs.h
core_rpc_server_error_codes.h) core_rpc_server_error_codes.h)
source_group(rpc bitmonero_add_library(rpc
FILES
${rpc_sources}
${rpc_headers})
add_library(rpc
${rpc_sources} ${rpc_sources}
${rpc_headers}) ${rpc_headers})
target_link_libraries(rpc target_link_libraries(rpc
@ -52,6 +47,3 @@ target_link_libraries(rpc
${EXTRA_LIBRARIES}) ${EXTRA_LIBRARIES})
add_dependencies(rpc add_dependencies(rpc
version) version)
set_property(TARGET rpc
PROPERTY
FOLDER "libs")

View file

@ -37,12 +37,7 @@ set(wallet_headers
wallet_rpc_server_commands_defs.h wallet_rpc_server_commands_defs.h
wallet_rpc_server_error_codes.h) wallet_rpc_server_error_codes.h)
source_group(wallet bitmonero_add_library(wallet
FILES
${wallet_sources}
${wallet_headers})
add_library(wallet
${wallet_sources} ${wallet_sources}
${wallet_headers}) ${wallet_headers})
target_link_libraries(wallet target_link_libraries(wallet
@ -54,6 +49,3 @@ target_link_libraries(wallet
${Boost_SYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY} ${Boost_THREAD_LIBRARY}
${EXTRA_LIBRARIES}) ${EXTRA_LIBRARIES})
set_property(TARGET wallet
PROPERTY
FOLDER "libs")