# Boost
# Cmake
TIP
If using Clion, the boost library should be at the folder C:/Boost and not C:/Boost_1_73_0
A common Cmake file for using Boost
cmake_minimum_required(VERSION 3.16)
project(Serial_Communication)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Boost)
if (NOT boost_FOUND)
set(Boost_INCLUDE_DIR "C:/boost")
set(Boost_LIBRARY_DIRS "C:/boost/stage/lib")
set(Boost_LIBRARIES "")
endif()
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
add_executable(Serial_Communication main.cpp)
target_link_libraries(Serial_Communication ${Boost_LIBRARIES})
# Utilities
set(CMAKE_DIR "C:/Cmake")
find_program(CMAKE_EXECUTABLE NAMES cmake HINTS ${cmake_dir} ENV CMAKE_DIR PATH_SUFFIXES bin)
# Build
set_property(TARGET Serial_Communication PROPERTY CXX_STANDARD 17)
# Install
install(TARGETS Serial_Communication DESTINATION ${PROJECT_SOURCE_DIR}/bin)
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
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
# Serial Communication
Default standard format for sending data 8N1 which is 8bits data packets with no parity and one stop bit.