mirror of
https://github.com/monero-project/monero.git
synced 2024-12-28 13:49:24 -05:00
cmake: refactor common code with executables
This commit is contained in:
parent
89cff7bddc
commit
c773f465ca
@ -32,6 +32,30 @@ add_definitions(-DSTATICLIB)
|
||||
# miniupnp changed their static define
|
||||
add_definitions(-DMINIUPNP_STATICLIB)
|
||||
|
||||
function (bitmonero_add_executable name)
|
||||
source_group("${name}"
|
||||
FILES
|
||||
${ARGN})
|
||||
|
||||
add_executable("${name}"
|
||||
${ARGN})
|
||||
target_link_libraries("${name}"
|
||||
PRIVATE
|
||||
${EXTRA_LIBRARIES})
|
||||
set_property(TARGET "${name}"
|
||||
PROPERTY
|
||||
FOLDER "prog")
|
||||
|
||||
if (STATIC)
|
||||
set_property(TARGET "${name}"
|
||||
PROPERTY
|
||||
LINK_SEARCH_START_STATIC 1)
|
||||
set_property(TARGET "${name}"
|
||||
PROPERTY
|
||||
LINK_SEARCH_END_STATIC 1)
|
||||
endif ()
|
||||
endfunction ()
|
||||
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(crypto)
|
||||
add_subdirectory(cryptonote_core)
|
||||
|
@ -31,12 +31,7 @@ set(connectivity_tool_sources
|
||||
|
||||
set(connectivity_tool_headers)
|
||||
|
||||
source_group(connectivity-tool
|
||||
FILES
|
||||
${connectivity_tool_sources}
|
||||
${connectivity_tool_headers})
|
||||
|
||||
add_executable(connectivity_tool
|
||||
bitmonero_add_executable(connectivity_tool
|
||||
${connectivity_tool_sources}
|
||||
${connectivity_tool_headers})
|
||||
target_link_libraries(connectivity_tool
|
||||
@ -48,15 +43,3 @@ target_link_libraries(connectivity_tool
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
${Boost_REGEX_LIBRARY}
|
||||
${Boost_SYSTEM_LIBRARY})
|
||||
set_property(TARGET connectivity_tool
|
||||
PROPERTY
|
||||
FOLDER "prog")
|
||||
|
||||
if (STATIC)
|
||||
set_property(TARGET connectivity_tool
|
||||
PROPERTY
|
||||
LINK_SEARCH_START_STATIC 1)
|
||||
set_property(TARGET connectivity_tool
|
||||
PROPERTY
|
||||
LINK_SEARCH_END_STATIC 1)
|
||||
endif ()
|
||||
|
@ -48,12 +48,7 @@ set(daemon_headers
|
||||
../p2p/p2p_protocol_defs.h
|
||||
../p2p/stdafx.h)
|
||||
|
||||
source_group(daemon
|
||||
FILES
|
||||
${daemon_sources}
|
||||
${daemon_headers})
|
||||
|
||||
add_executable(daemon
|
||||
bitmonero_add_executable(daemon
|
||||
${daemon_sources}
|
||||
${daemon_headers})
|
||||
target_link_libraries(daemon
|
||||
@ -72,18 +67,6 @@ target_link_libraries(daemon
|
||||
${EXTRA_LIBRARIES})
|
||||
add_dependencies(daemon
|
||||
version)
|
||||
set_property(TARGET daemon
|
||||
PROPERTY
|
||||
FOLDER "prog")
|
||||
set_property(TARGET daemon
|
||||
PROPERTY
|
||||
OUTPUT_NAME "bitmonerod")
|
||||
|
||||
if (STATIC)
|
||||
set_property(TARGET daemon
|
||||
PROPERTY
|
||||
LINK_SEARCH_START_STATIC 1)
|
||||
set_property(TARGET daemon
|
||||
PROPERTY
|
||||
LINK_SEARCH_END_STATIC 1)
|
||||
endif ()
|
||||
|
@ -34,12 +34,7 @@ set(simpleminer_headers
|
||||
simpleminer_protocol_defs.h
|
||||
target_helper.h)
|
||||
|
||||
source_group(simpleminer
|
||||
FILES
|
||||
${simpleminer_sources}
|
||||
${simpleminer_headers})
|
||||
|
||||
add_executable(simpleminer
|
||||
bitmonero_add_executable(simpleminer
|
||||
${simpleminer_sources}
|
||||
${simpleminer_headers})
|
||||
target_link_libraries(simpleminer
|
||||
@ -52,15 +47,3 @@ target_link_libraries(simpleminer
|
||||
${Boost_SYSTEM_LIBRARY}
|
||||
${Boost_THREAD_LIBRARY}
|
||||
${EXTRA_LIBRARIES})
|
||||
set_property(TARGET simpleminer
|
||||
PROPERTY
|
||||
FOLDER "prog")
|
||||
|
||||
if (STATIC)
|
||||
set_property(TARGET simpleminer
|
||||
PROPERTY
|
||||
LINK_SEARCH_START_STATIC 1)
|
||||
set_property(TARGET simpleminer
|
||||
PROPERTY
|
||||
LINK_SEARCH_END_STATIC 1)
|
||||
endif ()
|
||||
|
@ -34,12 +34,7 @@ set(simplewallet_headers
|
||||
simplewallet.h
|
||||
password_container.h)
|
||||
|
||||
source_group(simplewallet
|
||||
FILES
|
||||
${simplewallet_sources}
|
||||
${simplewallet_headers})
|
||||
|
||||
add_executable(simplewallet
|
||||
bitmonero_add_executable(simplewallet
|
||||
${simplewallet_sources}
|
||||
${simplewallet_headers})
|
||||
target_link_libraries(simplewallet
|
||||
@ -56,15 +51,3 @@ target_link_libraries(simplewallet
|
||||
${EXTRA_LIBRARIES})
|
||||
add_dependencies(simplewallet
|
||||
version)
|
||||
set_property(TARGET simplewallet
|
||||
PROPERTY
|
||||
FOLDER "prog")
|
||||
|
||||
if (STATIC)
|
||||
set_property(TARGET simplewallet
|
||||
PROPERTY
|
||||
LINK_SEARCH_START_STATIC 1)
|
||||
set_property(TARGET simplewallet
|
||||
PROPERTY
|
||||
LINK_SEARCH_END_STATIC 1)
|
||||
endif ()
|
||||
|
Loading…
Reference in New Issue
Block a user