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 ()
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(crypto)
add_subdirectory(cryptonote_core)

View file

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

View file

@ -66,14 +66,6 @@ set(crypto_headers
skein.h
skein_port.h)
source_group(crypto
FILES
bitmonero_add_library(crypto
${crypto_sources}
${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
verification_context.h)
source_group(cryptonote_core
FILES
${cryptonote_core_sources}
${cryptonote_core_headers})
add_library(cryptonote_core
bitmonero_add_library(cryptonote_core
${cryptonote_core_sources}
${cryptonote_core_headers})
target_link_libraries(cryptonote_core
@ -78,6 +73,3 @@ target_link_libraries(cryptonote_core
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${EXTRA_LIBRARIES})
set_property(TARGET cryptonote_core
PROPERTY
FOLDER "libs")

View file

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

View file

@ -34,12 +34,7 @@ set(rpc_headers
core_rpc_server_commands_defs.h
core_rpc_server_error_codes.h)
source_group(rpc
FILES
${rpc_sources}
${rpc_headers})
add_library(rpc
bitmonero_add_library(rpc
${rpc_sources}
${rpc_headers})
target_link_libraries(rpc
@ -52,6 +47,3 @@ target_link_libraries(rpc
${EXTRA_LIBRARIES})
add_dependencies(rpc
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_error_codes.h)
source_group(wallet
FILES
${wallet_sources}
${wallet_headers})
add_library(wallet
bitmonero_add_library(wallet
${wallet_sources}
${wallet_headers})
target_link_libraries(wallet
@ -54,6 +49,3 @@ target_link_libraries(wallet
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${EXTRA_LIBRARIES})
set_property(TARGET wallet
PROPERTY
FOLDER "libs")