-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
45 lines (33 loc) · 1.18 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
cmake_minimum_required(VERSION 3.14)
project( SerialPort )
set(CMAKE_CXX_STANDARD 17)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_library(SerialPort STATIC
"src/serial_port.cc"
"src/interface.cc" "src/interface.h"
"src/serial_port_windows.cc" "src/serial_port_windows.h"
"src/serial_port_linux.cc" "src/serial_port_linux.h"
"include/serial_port/types.h" "src/enumeration.h" "src/enumeration.cpp")
target_include_directories (SerialPort PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
enable_testing()
add_executable(
"serial_port_tests"
"test/tests.cc"
"src/enumeration.h" "src/enumeration.cpp")
target_link_libraries(
serial_port_tests
gtest_main
SerialPort
)
include(GoogleTest)
gtest_discover_tests(serial_port_tests)