-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
88 lines (72 loc) · 2.54 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
86
87
88
project (astlib)
cmake_minimum_required(VERSION 3.3)
set (PROJECT_NAME "astlib")
set (PROJECT_LOG_MODULE_NAME "astlib")
set (PROJECT_CODENAME "${PROJECT_NAME}")
execute_process (
COMMAND date "+%Y"
OUTPUT_VARIABLE PROJECT_COPYRIGHT_YEARS
OUTPUT_STRIP_TRAILING_WHITESPACE)
set (PROJECT_VERSION_MAJOR 0)
set (PROJECT_VERSION_MINOR 9)
set (PROJECT_VERSION_PATCH 0)
set (PROJECT_VERSION_TYPE SNAPSHOT)
set (PROJECT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-${PROJECT_VERSION_TYPE}")
set (PROJECT_VENDOR_ID "aero.rsys")
set (PROJECT_VENDOR_NAME "R-SYS s.r.o.")
set (PROJECT_VENDOR_URL "www.r-sys.sk")
set (PROJECT_ID "${PROJECT_VENDOR_ID}.${PROJECT_NAME}")
#
# Project Output Paths
#
set (MAINFOLDER ${PROJECT_SOURCE_DIR})
set (EXECUTABLE_OUTPUT_PATH "bin")
set (ARCHIVE_OUTPUT_DIRECTORY "lib")
set (RUNTIME_OUTPUT_DIRECTORY "lib")
set (LIBRARY_OUTPUT_DIRECTORY "lib")
include_directories(.)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)
set(CMAKE_CXX_EXTENSIONS off)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()
message("++ Build Type: " ${CMAKE_BUILD_TYPE})
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -fPIC")
endif()
find_package(Poco 1.7.0 REQUIRED COMPONENTS Net Util XML JSON Foundation CONFIG PATHS "/opt/rsys/platform" "d:/opt/rsys/platform")
if ( NOT Poco_FOUND)
message(FATAL_ERROR "Package Poco and it's components required, but not found!")
endif()
add_subdirectory(astlib lib)
set(LIBS astlib ${Poco_LIBRARIES} ${SYSTEM_LIBS})
include_directories(${Poco_INCLUDE_DIRECTORIES})
target_include_directories(astlib INTERFACE .)
add_executable(binary2asterix examples/binary2asterix.cpp)
target_link_libraries(binary2asterix ${LIBS})
add_executable(ast2json src/ast2json.cpp)
target_link_libraries(ast2json ${LIBS})
# Setup GTEST testing
find_package(GTest)
if (GTEST_FOUND)
enable_testing()
include_directories(${GTEST_INCLUDE_DIR})
message(STATUS "Found GTest: ${GTEST_LIBRARY}")
endif()
# Test units
if (GTEST_FOUND)
aux_source_directory ( tests/unit tu_srcs2)
add_executable ( testunit ${tu_srcs2} )
IF (CMAKE_SYSTEM MATCHES "Windows")
IF (CMAKE_BUILD_TYPE MATCHES "Debug")
target_link_libraries( testunit ${LIBS} ${GTEST_LIBRARY_DEBUG} ${GTEST_MAIN_LIBRARY_DEBUG})
else()
target_link_libraries( testunit ${LIBS} ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
endif()
else()
target_link_libraries( testunit ${LIBS} ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
endif()
endif()