aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2014-10-21 11:21:28 -0400
committerBen Boeckel <ben.boeckel@kitware.com>2014-10-23 16:42:34 -0400
commitc773f465ca7e691b94394d8c7c682c8eb78e5c25 (patch)
tree608ab12a156706ef1c876a33614f3ac6b400d6c3 /src
parentcmake: put each library into its own directory (diff)
downloadmonero-c773f465ca7e691b94394d8c7c682c8eb78e5c25.tar.xz
cmake: refactor common code with executables
Diffstat (limited to '')
-rw-r--r--src/CMakeLists.txt24
-rw-r--r--src/connectivity_tool/CMakeLists.txt19
-rw-r--r--src/daemon/CMakeLists.txt19
-rw-r--r--src/miner/CMakeLists.txt19
-rw-r--r--src/simplewallet/CMakeLists.txt19
5 files changed, 28 insertions, 72 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 790b44593..868bdc2e9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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)
diff --git a/src/connectivity_tool/CMakeLists.txt b/src/connectivity_tool/CMakeLists.txt
index 150815a5d..de52b0648 100644
--- a/src/connectivity_tool/CMakeLists.txt
+++ b/src/connectivity_tool/CMakeLists.txt
@@ -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 ()
diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt
index 6cb5f8625..fdf6d697c 100644
--- a/src/daemon/CMakeLists.txt
+++ b/src/daemon/CMakeLists.txt
@@ -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
@@ -74,16 +69,4 @@ 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 ()
diff --git a/src/miner/CMakeLists.txt b/src/miner/CMakeLists.txt
index 551d9e70a..7f8669665 100644
--- a/src/miner/CMakeLists.txt
+++ b/src/miner/CMakeLists.txt
@@ -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 ()
diff --git a/src/simplewallet/CMakeLists.txt b/src/simplewallet/CMakeLists.txt
index 756b8d753..310efc2f1 100644
--- a/src/simplewallet/CMakeLists.txt
+++ b/src/simplewallet/CMakeLists.txt
@@ -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 ()