-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
74 lines (58 loc) · 2.24 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
cmake_minimum_required(VERSION 3.0.0)
project(parse VERSION 0.1.0)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
set(TSN_PARSE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE STRING "TSN Parser Include Dir")
set (all_sources "")
macro(add_sources group dir)
set(_all "")
file(GLOB _inc "include/parse/${dir}/*.h" "include/parse/${dir}/*.hpp" "include/parse/${dir}/*.inl")
list(APPEND _all ${_inc})
file(GLOB _src "src/${dir}/*.cpp" "src/${dir}/*.c")
list(APPEND _all ${_src})
list(APPEND all_sources ${_all})
string(REPLACE "/" "\\" group_path "${group}")
source_group(${group_path} FILES ${_all})
unset(_inc)
unset(_src)
unset(_all)
endmacro(add_sources)
add_sources("src" ".")
add_sources("src/misc" "misc")
add_sources("src/types" "types")
add_sources("src/classes" "classes")
add_sources("src/proxies" "proxies")
add_sources("src/literals" "literals")
add_sources("src/statements" "statements")
add_sources("src/expressions" "expressions")
add_sources("src/declarations" "declarations")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if (NOT TARGET tokenize)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/tokenize)
endif()
include_directories(
${TSN_PARSE_INCLUDE_DIR}
${TSN_TOKENIZE_INCLUDE_DIR}
${TSN_UTILS_INCLUDE_DIR}
)
add_library(parse ${all_sources})
target_link_libraries(parse tokenize)
if (CMAKE_VERSION VERSION_GREATER 3.7.8)
if (MSVC_IDE)
option(VS_ADD_NATIVE_VISUALIZERS "Configure project to use Visual Studio native visualizers" TRUE)
else()
set(VS_ADD_NATIVE_VISUALIZERS FALSE CACHE INTERNAL "Native visualizers are a Visual Studio extension" FORCE)
endif()
# add natvis file to the library so it will automatically be loaded into Visual Studio
if (VS_ADD_NATIVE_VISUALIZERS)
target_sources(parse INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/types.natvis
)
endif()
endif()
add_subdirectory("./test")