aboutsummaryrefslogtreecommitdiff
path: root/client/helloworld/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'client/helloworld/CMakeLists.txt')
-rw-r--r--client/helloworld/CMakeLists.txt50
1 files changed, 50 insertions, 0 deletions
diff --git a/client/helloworld/CMakeLists.txt b/client/helloworld/CMakeLists.txt
new file mode 100644
index 0000000..f36e020
--- /dev/null
+++ b/client/helloworld/CMakeLists.txt
@@ -0,0 +1,50 @@
+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
+if(WIN32)
+ set(APPS_DEPS ws2_32)
+endif()
+set(APPS_DEPS ${APPS_DEPS} ac)
+add_executable(helloworld
+ main.c
+ net.c
+ net.h
+ )
+target_link_libraries(helloworld ${APPS_DEPS})
+
+install(TARGETS helloworld
+ 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
+)