aboutsummaryrefslogtreecommitdiff
path: root/client/acronc/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'client/acronc/CMakeLists.txt')
-rw-r--r--client/acronc/CMakeLists.txt68
1 files changed, 68 insertions, 0 deletions
diff --git a/client/acronc/CMakeLists.txt b/client/acronc/CMakeLists.txt
new file mode 100644
index 0000000..ec2b7fb
--- /dev/null
+++ b/client/acronc/CMakeLists.txt
@@ -0,0 +1,68 @@
+cmake_minimum_required(VERSION 3.22)
+project(libac C)
+
+set(CMAKE_C_STANDARD 11)
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Debug)
+endif()
+
+add_definitions(-D_POSIX_C_SOURCE=200809L)
+IF(CMAKE_BUILD_TYPE MATCHES Debug)
+ add_definitions(-DDEBUG)
+ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
+
+if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
+ set(CMAKE_C_FLAGS_DEBUG
+ "${CMAKE_C_FLAGS_DEBUG} -g3 -O0 -fsanitize=address")
+ set(CMAKE_EXE_LINKER_FLAGS_DEBUG
+ "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=address")
+ set(CMAKE_C_FLAGS
+ "${CMAKE_C_FLAGS} -fvisibility=hidden")
+elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
+ # TODO: MSVC ASAN
+ set(CMAKE_C_FLAGS_DEBUG
+ "${CMAKE_C_FLAGS_DEBUG} /DEBUG /Z7 /Od")
+ set(CMAKE_EXE_LINKER_FLAGS_DEBUG
+ "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
+endif()
+
+add_subdirectory(../libacron ${CMAKE_BINARY_DIR}/libac)
+
+# helloworld
+#add_executable(helloworld
+# helloworld/main.c
+# helloworld/net.c
+# helloworld/net.h
+# )
+#target_link_libraries(helloworld ${APPS_DEPS})
+#target_include_directories(helloworld PUBLIC "${PROJECT_BINARY_DIR}" include/)
+
+# acronc
+add_executable(acronc
+ main.c
+ common.h
+ log.h
+ log.c
+ handler.h
+ handler_signal.c
+ config.c
+ config.h
+ client.c
+ client.h
+ handler_stdin.c
+ helpers.c
+ helpers.h
+ handler_socket.c
+ async_dns.c
+ )
+target_link_libraries(acronc ${APPS_DEPS} uv ac)
+target_include_directories(acronc PUBLIC "${PROJECT_BINARY_DIR}" include/)
+
+install(TARGETS acronc
+ EXPORT ${PROJECT_NAME}-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/libac
+)