aboutsummaryrefslogtreecommitdiff
path: root/client/acronc/CMakeLists.txt
blob: ec2b7fbae8704233971a68618db1b62e6527db69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
)