-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
85 lines (72 loc) · 2.2 KB
/
CMakeLists.txt
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Set the minimum version of CMake that can be used
# To find the cmake version run
# $ cmake --version
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
# Set up the project
project(telnet-rtt
VERSION 1.0.0
LANGUAGES C
)
# Set c standard
set(CMAKE_C_STANDARD 11)
# Command to output information to the console
# Useful for displaying errors, warnings, and debugging
message ("c Flags: " ${CMAKE_C_FLAGS})
# Set c++ standard
set(CMAKE_Cxx_STANDARD 20)
# Command to output information to the console
# Useful for displaying errors, warnings, and debugging
message ("cxx Flags: " ${CMAKE_CXX_FLAGS})
# Create a sources variable with a link to all cpp files to compile
set(SOURCES
main.c
)
# Set Properties->General->Configuration Type to Application(.exe)
# Creates app.exe with the listed sources (main.cxx)
# Adds sources to the Solution Explorer
# Add an executable with the above sources
add_executable(${PROJECT_NAME} ${SOURCES})
# Pick up the common stuff
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/tcapi)
# add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/util)
# add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/shell)
if (WIN32)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/getopt)
endif (WIN32)
# Set the directories that should be included in the build command for this target
# when running g++ these will be included as -I/directory/path/
# Properties->C/C++->General->Additional Include Directories
target_include_directories(${PROJECT_NAME}
PRIVATE
${PROJECT_SOURCE_DIR}/
)
# Set compile definitions
if (WIN32)
target_compile_definitions(${PROJECT_NAME}
PRIVATE
# "HAVE_CONFIG_H"
" _CRT_SECURE_NO_WARNINGS"
"_WINSOCK_DEPRECATED_NO_WARNINGS"
# "LargestIntegralType=unsigned long"
# LargestIntegralTypePrintfFormat="%llx"
)
endif (WIN32)
# Set compile Linker lib
if (WIN32)
target_link_libraries(${PROJECT_NAME}
PRIVATE
ws2_32.lib
)
endif (WIN32)
# Set compile Linker lib
if (UNIX)
target_link_libraries(${PROJECT_NAME}
PRIVATE
-ludev
-lSDL2
-lm
)
endif (UNIX)
if (UNIX)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${SIZE} "${PROJECT_NAME}")
endif (UNIX)