This repository has been archived by the owner on Feb 28, 2019. It is now read-only.
forked from Jester565/CommSerial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
70 lines (55 loc) · 1.93 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
cmake_minimum_required( VERSION 2.6 )
set (PROJECT_NAME CommSerial)
set (COM_LIB_NAME ComSer)
set (TEST_NAME ComSerTest)
project(${PROJECT_NAME})
option(release "Compile the release version" OFF)
if (release)
set (CMAKE_BUILD_TYPE Release)
else()
set (CMAKE_BUILD_TYPE Debug)
endif()
#hopefully linux just ignores this
#sets default project to test soultion
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${TEST_NAME})
set(HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/include/)
set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/src/)
include_directories(SYSTEM ${HEADER_DIR})
set(CS_HEADERS
${HEADER_DIR}/Parser.h
${HEADER_DIR}/Serial.h
${HEADER_DIR}/SerialConnection.h
${HEADER_DIR}/ConditionVariable.h
${HEADER_DIR}/Crc.h
${HEADER_DIR}/ObjStream.h
${HEADER_DIR}/Base32.h
${HEADER_DIR}/Packet.h
${HEADER_DIR}/PackManager.h
${HEADER_DIR}/stdafx.h)
set(CS_SOURCES
${SOURCE_DIR}/Parser.cpp
${SOURCE_DIR}/WinSerial.cpp
${SOURCE_DIR}/LinSerial.cpp
${SOURCE_DIR}/SerialConnection.cpp
${SOURCE_DIR}/Base32.cpp
${SOURCE_DIR}/PackManager.cpp
${SOURCE_DIR}/ObjStream.cpp)
set(CS_GLOB
${CS_HEADERS}
${CS_SOURCES})
find_package(Threads)
add_library(${COM_LIB_NAME} STATIC ${CS_GLOB})
set(TEST_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/Test/TestPack.h
${CMAKE_CURRENT_SOURCE_DIR}/Test/LargePack.h
${CMAKE_CURRENT_SOURCE_DIR}/Test/HamManager.h)
set(TEST_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/Test/Source.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Test/TestPack.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Test/LargePack.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Test/HamManager.cpp)
add_executable(${TEST_NAME} ${TEST_HEADERS} ${TEST_SOURCES})
target_link_libraries(${TEST_NAME} ${COM_LIB_NAME})
target_link_libraries(${TEST_NAME} ${COM_LIB_NAME} ${CMAKE_THREAD_LIBS_INIT})
set_property(TARGET ${COM_LIB_NAME} ${TEST_NAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${COM_LIB_NAME} ${TEST_NAME} PROPERTY CXX_STANDARD_REQUIRED 11)