cadMousePro-gui/src/CMakeLists.txt
author František Kučera <franta-hg@frantovo.cz>
Fri, 30 Aug 2019 01:22:12 +0200
branchv_0
changeset 16 2705911938b4
parent 15 00783e323e66
child 21 642f32f76c9d
permissions -rw-r--r--
GUI for mouse configuration over D-Bus daemon
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/)
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
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
    17
set(GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/generated-sources/)
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
add_custom_command(
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
	DEPENDS ${DBUS_XML}
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
	OUTPUT ${GENERATED_SOURCES}/Proxy.h
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
	OUTPUT ${GENERATED_SOURCES}/Proxy.cpp
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
	COMMAND qdbusxml2cpp -p Proxy.h:Proxy.cpp ${DBUS_XML}
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
	WORKING_DIRECTORY ${GENERATED_SOURCES}
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
)
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
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
    26
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
# Executable output:
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
add_executable(
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
	${EXECUTABLE_FILE}
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
	${CMAKE_CURRENT_BINARY_DIR}/generated-sources/Proxy.h
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
	${CMAKE_CURRENT_BINARY_DIR}/generated-sources/Proxy.cpp
15
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents: 14
diff changeset
    32
	MouseMainWindow.h
16
2705911938b4 GUI for mouse configuration over D-Bus daemon
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    33
	MouseMainWindow.cpp
14
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	cadMouseProGUI.cpp
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
)
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
# Link libraries:
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
target_link_libraries(${EXECUTABLE_FILE} Qt5::DBus)
15
00783e323e66 main window
František Kučera <franta-hg@frantovo.cz>
parents: 14
diff changeset
    39
target_link_libraries(${EXECUTABLE_FILE} Qt5::Widgets)
14
759edaff1755 GUI project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
set_property(TARGET ${EXECUTABLE_FILE} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)