-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (51 loc) · 1.86 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
cmake_minimum_required(VERSION 3.16)
project(RADRunner)
if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/EHsc /W4)
else()
add_compile_options(-fno-asynchronous-unwind-tables -Wall -Wextra)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_definitions(_DEBUG MUNGWALL_NO_LINE_TRACKING)
endif()
set(sourceFiles "RADRunner.cpp")
set(sourceFiles ${sourceFiles} "ClientCommands.cpp")
set(sourceFiles ${sourceFiles} "Execute.cpp")
set(sourceFiles ${sourceFiles} "ServerCommands.cpp")
find_library(StdFuncs StdFuncs PATHS ../StdFuncs PATH_SUFFIXES build)
find_package(Qt5 COMPONENTS Core Gui Widgets)
if(${Qt5_FOUND} EQUAL 1)
message(STATUS "Configuring using Qt5 directory ${Qt5_DIR}")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
add_executable(RADRunner ${sourceFiles})
add_compile_definitions(QT_GUI_LIB)
target_link_libraries(RADRunner ${StdFuncs})
target_link_libraries(RADRunner Qt5::Core Qt5::Gui Qt5::Widgets)
else()
message(STATUS "Qt5 not found, configuring basic build")
add_executable(RADRunner ${sourceFiles})
target_link_libraries(RADRunner ${StdFuncs})
endif()
set_property(TARGET RADRunner PROPERTY CXX_STANDARD 14)
set_property(TARGET RADRunner PROPERTY CXX_STANDARD_REQUIRED ON)
if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS "/SUBSYSTEM:CONSOLE")
set_target_properties(RADRunner PROPERTIES LINK_FLAGS /SUBSYSTEM:CONSOLE)
endif()
target_include_directories(RADRunner PRIVATE "../StdFuncs")
if(WIN32)
target_link_libraries(RADRunner "ws2_32")
endif()
if(USE_CLANG_TIDY)
find_program(ClangTidy NAMES "clang-tidy")
if(ClangTidy)
message(STATUS "Found clang-tidy as ${ClangTidy}")
set(RunClangTidy ${ClangTidy})
set_target_properties(RADRunner PROPERTIES C_CLANG_TIDY "${RunClangTidy}" CXX_CLANG_TIDY "${RunClangTidy}")
else()
message(STATUS "clang-tidy not found, so will not be used")
endif()
endif()