-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
85 lines (73 loc) · 2.54 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
80
81
82
83
84
85
# evtest-qt - A graphical joystick tester
# Copyright (C) 2015 Ingo Ruhnke <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.7)
project(evtest-qt)
include(mk/cmake/TinyCMMC.cmake)
find_package(Qt6 COMPONENTS Core Widgets)
if(Qt6_FOUND)
set(QT_LIBRARIES Qt6::Core Qt6::Widgets)
message(STATUS "Using Qt version: Qt6")
else()
find_package(Qt5 COMPONENTS Core Widgets)
if(Qt5_FOUND)
set(QT_LIBRARIES Qt5::Core Qt5::Widgets)
message(STATUS "Using Qt version: Qt5")
else()
find_package(Qt4 REQUIRED)
set(QT_LIBRARIES Qt4::QtGui)
message(STATUS "Using Qt version: Qt4")
endif()
endif()
if(Qt6_FOUND)
qt_standard_project_setup()
else()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
endif()
if (BUILD_TESTS)
enable_testing()
endif(BUILD_TESTS)
file(GLOB EVTEST_QT_SOURCES
src/widgets/*.cpp
src/evdev/*.cpp
src/evtest_app.cpp
)
add_library(evtest-qt STATIC ${EVTEST_QT_SOURCES})
target_include_directories(evtest-qt PUBLIC src/)
target_link_libraries(evtest-qt PUBLIC ${QT_LIBRARIES})
target_compile_options(evtest-qt PRIVATE ${TINYCMMC_WARNINGS_CXX_FLAGS})
file(GLOB EVTEST_QT_MAIN_SOURCES
src/main.cpp
)
add_executable(evtest-qt_exe ${EVTEST_QT_MAIN_SOURCES})
target_link_libraries(evtest-qt_exe evtest-qt)
set_target_properties(evtest-qt_exe PROPERTIES
OUTPUT_NAME "evtest-qt")
target_compile_options(evtest-qt_exe PRIVATE ${TINYCMMC_WARNINGS_CXX_FLAGS})
target_compile_definitions(evtest-qt_exe PRIVATE -DEVTEST_QT_VERSION="${PROJECT_VERSION}")
add_executable(evdev-test src/evdev_test.cpp)
target_link_libraries(evdev-test evtest-qt)
target_compile_options(evdev-test PRIVATE ${TINYCMMC_WARNINGS_CXX_FLAGS})
install(TARGETS evtest-qt_exe
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES
evtest-qt.svg
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
install(FILES
evtest-qt.desktop
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
# EOF #