-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
80 lines (64 loc) · 2.17 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
cmake_minimum_required(VERSION 3.12)
project(vhf-sim
VERSION 2.0.1
LANGUAGES CXX C
DESCRIPTION "VHF Simulator for maritime radio certificate SRC"
HOMEPAGE_URL "https://github.com/mariokonrad/vhf-sim"
)
set(PROJECT_LICENSE "GPLv3")
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
### module and prefix path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
if(DEFINED ENV{QTHOME})
message(STATUS "QTHOME: $ENV{QTHOME}")
set(CMAKE_PREFIX_PATH "$ENV{QTHOME}")
endif()
### information about repository
include(GitInformation)
### build type
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
### compiler check
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang")
message(STATUS "C++ Compiler: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "C Compiler : ${CMAKE_C_COMPILER_ID}")
else()
message(FATAL_ERROR "Unsupported compiler detected: ${CMAKE_CXX_COMPILER_ID}")
endif()
# C++11, no compiler extensions
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
### package handling
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/${PROJECT_NAME}/lang)
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Multimedia REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5LinguistTools REQUIRED)
### internationalization
set(TRANSLATION_FILES
${CMAKE_CURRENT_SOURCE_DIR}/lang/de_DE.ts
)
add_custom_target(language-update)
foreach(filename ${TRANSLATION_FILES})
add_custom_command(TARGET language-update PRE_BUILD
COMMAND ${Qt5_LUPDATE_EXECUTABLE} -no-obsolete -recursive ${CMAKE_CURRENT_SOURCE_DIR}/src -ts ${filename}
)
endforeach()
### sources
add_subdirectory(src)
### ctags / cscope
include(CTags)
### packaging
include(CPack.local)