-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
74 lines (60 loc) · 1.7 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.14)
# Set the project name and version
project(MapLeCreusot VERSION 1.0)
# Specify the required Qt modules
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets)
# Set C++11 as the standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add compiler definitions
add_definitions(-DQT_DEPRECATED_WARNINGS)
# Uncomment this line if you want to disable deprecated APIs before Qt 6
# add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000)
# Find libosmium
find_path(LIBOSMIUM_INCLUDE_DIRS "osmium/osm.hpp")
if(NOT LIBOSMIUM_INCLUDE_DIRS)
message(FATAL_ERROR "libosmium not found. Please install libosmium.")
endif()
# Find protozero
find_path(PROTOZERO_INCLUDE_DIRS "protozero/byteswap.hpp")
if(NOT PROTOZERO_INCLUDE_DIRS)
message(FATAL_ERROR "protozero not found. Please install protozero.")
endif()
# Include directories
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${LIBOSMIUM_INCLUDE_DIRS}
${PROTOZERO_INCLUDE_DIRS}
)
# Define sources (now located in the src folder)
file(GLOB SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
)
# Define UI forms
set(FORMS
${CMAKE_CURRENT_SOURCE_DIR}/ui/mainwindow.ui
)
# Tell CMake where to look for the .ui files
set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/ui) # set the folder where .ui files are
# Create executable
add_executable(${PROJECT_NAME} ${SOURCES} ${FORMS})
# Link libraries
target_link_libraries(
${PROJECT_NAME}
Qt5::Core
Qt5::Gui
Qt5::Widgets
pthread
expat
z
)
# Install target
install(
TARGETS
${PROJECT_NAME}
DESTINATION
/opt/${PROJECT_NAME}/bin
)