aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt7
-rw-r--r--src/CMakeLists.txt20
2 files changed, 18 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..093593d
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.0)
+
+project(cimple VERSION 0.0.1 LANGUAGES C)
+
+add_subdirectory(src)
+
+install(FILES LICENSE.txt DESTINATION "share/doc/${PROJECT_NAME}")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0d3c7e9..10c7066 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,3 @@
-cmake_minimum_required(VERSION 3.0)
-
-project(cimple VERSION 0.0.1 LANGUAGES C)
-
if(MSVC)
add_compile_options(/W4 /WX)
else()
@@ -12,18 +8,26 @@ add_compile_definitions(_GNU_SOURCE)
add_compile_definitions(VERSION="${PROJECT_VERSION}")
-add_executable(server server_main.c server.c
+function(add_my_executable name)
+ list(POP_FRONT ARGV)
+ add_executable("${name}" ${ARGV})
+ set_target_properties("${name}" PROPERTIES OUTPUT_NAME "${PROJECT_NAME}-${name}")
+ install(TARGETS "${name}" RUNTIME DESTINATION bin)
+endfunction()
+
+add_my_executable(server server_main.c server.c
ci_queue.c
msg.c
net.c
signal.c
tcp_server.c)
+target_link_libraries(server PRIVATE pthread)
-add_executable(client client_main.c client.c
+add_my_executable(client client_main.c client.c
msg.c
net.c)
-add_executable(worker worker_main.c worker.c
+add_my_executable(worker worker_main.c worker.c
ci.c
file.c
git.c
@@ -31,6 +35,4 @@ add_executable(worker worker_main.c worker.c
net.c
process.c
signal.c)
-
-target_link_libraries(server PRIVATE pthread)
target_link_libraries(worker PRIVATE git2 pthread)