-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
66 lines (52 loc) · 1.5 KB
/
CMakeLists.txt
File metadata and controls
66 lines (52 loc) · 1.5 KB
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
cmake_minimum_required(VERSION 3.10)
project(GPUDebugger LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# Find Qt5 (adjust Qt5 if needed)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
# Read version from VERSION file
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VERSION_MAJOR_MINOR)
string(STRIP "${VERSION_MAJOR_MINOR}" VERSION_MAJOR_MINOR)
# Get git commit count (if available)
execute_process(
COMMAND git rev-list --count HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_COUNT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_COMMIT_COUNT)
set(GIT_COMMIT_COUNT 0)
endif()
set(APP_VERSION "${VERSION_MAJOR_MINOR}.${GIT_COMMIT_COUNT}")
# Get build date
string(TIMESTAMP APP_BUILD_DATE "%Y-%m-%d %H:%M:%S")
# Configure version.h
configure_file(
${CMAKE_SOURCE_DIR}/version.h.in
${CMAKE_BINARY_DIR}/version.h
@ONLY
)
# Add the generated version.h to the include paths
include_directories(${CMAKE_BINARY_DIR})
# Add source files
set(SOURCES
src/main.cpp
src/mainwindow.cpp
src/debugger.cpp
)
set(HEADERS
src/mainwindow.h
src/debugger.h
)
# Add executable
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
# Link Qt5 libraries
target_link_libraries(${PROJECT_NAME} Qt5::Widgets)
# Set output directory (optional)
set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
# Clap de fin
message(STATUS "Configuration of ${PROJECT_NAME} complete")