cadMousePro-gui/src/CMakeLists.txt
author František Kučera <franta-hg@frantovo.cz>
Wed, 04 Sep 2019 19:41:21 +0200
branchv_0
changeset 21 642f32f76c9d
parent 16 2705911938b4
permissions -rw-r--r--
display the battery charge level (from UPower)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
set(EXECUTABLE_FILE "cadMousePro-gui")
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
# Qt libraries:
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
set(CMAKE_INCLUDE_CURRENT_DIR ON) # Find includes in corresponding build directories
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
set(CMAKE_AUTOMOC ON) # Instruct CMake to run moc automatically when needed
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
set(CMAKE_AUTOUIC ON) # Create code from a list of Qt designer ui files
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
find_package(Qt5 CONFIG REQUIRED Core DBus)
15
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents: 14
diff changeset
     8
find_package(Qt5Widgets CONFIG REQUIRED)
14
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
# Add ASan AddressSanitizer
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
# Generate C++ interface classes from D-Bus XML:
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/generated-sources/)
21
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    16
set(GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/generated-sources/)
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    17
14
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
set(DBUS_XML ${CMAKE_CURRENT_SOURCE_DIR}/../../d-bus/info.globalcode.mouse.cadMousePro.xml)
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
add_custom_command(
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
	DEPENDS ${DBUS_XML}
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
	OUTPUT ${GENERATED_SOURCES}/Proxy.h
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
	OUTPUT ${GENERATED_SOURCES}/Proxy.cpp
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
	COMMAND qdbusxml2cpp -p Proxy.h:Proxy.cpp ${DBUS_XML}
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
	WORKING_DIRECTORY ${GENERATED_SOURCES}
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
)
21
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    26
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    27
set(DBUS_XML ${CMAKE_CURRENT_SOURCE_DIR}/../../d-bus/org.freedesktop.UPower.xml)
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    28
add_custom_command(
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    29
	DEPENDS ${DBUS_XML}
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    30
	OUTPUT ${GENERATED_SOURCES}/UPowerProxy.h
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    31
	OUTPUT ${GENERATED_SOURCES}/UPowerProxy.cpp
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    32
	COMMAND qdbusxml2cpp -N -p UPowerProxy.h:UPowerProxy.cpp ${DBUS_XML}
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    33
	WORKING_DIRECTORY ${GENERATED_SOURCES}
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    34
)
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    35
14
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
cmake_policy(SET CMP0071 NEW) # Let AUTOMOC and AUTOUIC process GENERATED files.
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
# Executable output:
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
add_executable(
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
	${EXECUTABLE_FILE}
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
	${CMAKE_CURRENT_BINARY_DIR}/generated-sources/Proxy.h
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
	${CMAKE_CURRENT_BINARY_DIR}/generated-sources/Proxy.cpp
21
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    43
	${CMAKE_CURRENT_BINARY_DIR}/generated-sources/UPowerProxy.h
642f32f76c9d display the battery charge level (from UPower)
František Kučera <franta-hg@frantovo.cz>
parents: 16
diff changeset
    44
	${CMAKE_CURRENT_BINARY_DIR}/generated-sources/UPowerProxy.cpp
15
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents: 14
diff changeset
    45
	MouseMainWindow.h
16
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    46
	MouseMainWindow.cpp
14
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
	cadMouseProGUI.cpp
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
)
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
# Link libraries:
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
target_link_libraries(${EXECUTABLE_FILE} Qt5::DBus)
15
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents: 14
diff changeset
    52
target_link_libraries(${EXECUTABLE_FILE} Qt5::Widgets)
14
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
set_property(TARGET ${EXECUTABLE_FILE} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)