src/CMakeLists.txt
author František Kučera <franta-hg@frantovo.cz>
Sat, 30 Mar 2019 16:14:41 +0100
branchv_0
changeset 38 129b8cca9b98
parent 33 ec98d2e080a0
child 42 707a6734f364
permissions -rw-r--r--
fix typo: Hadler → Handler
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     1
# Relational pipes
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     2
# Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info)
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     3
#
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     4
# This program is free software: you can redistribute it and/or modify
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     5
# it under the terms of the GNU General Public License as published by
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     6
# the Free Software Foundation, either version 3 of the License, or
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     7
# (at your option) any later version.
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     8
#
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
     9
# This program is distributed in the hope that it will be useful,
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    12
# GNU General Public License for more details.
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    13
#
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    14
# You should have received a copy of the GNU General Public License
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    15
# along with this program. If not, see <http://www.gnu.org/licenses/>.
0f9f7d6564cd license: GNU GPLv3+
František Kučera <franta-hg@frantovo.cz>
parents: 28
diff changeset
    16
27
8c5364450a46 rename from out-chart to out-gui
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    17
set(EXECUTABLE_FILE "relpipe-out-gui")
2
7ba3ae8cf1fc add relpipe pkg-config libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    18
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    19
# Qt libraries:
3
0d857519a4c9 add Qt libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    20
set(CMAKE_INCLUDE_CURRENT_DIR ON) # Find includes in corresponding build directories
0d857519a4c9 add Qt libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    21
set(CMAKE_AUTOMOC ON) # Instruct CMake to run moc automatically when needed
0d857519a4c9 add Qt libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    22
set(CMAKE_AUTOUIC ON) # Create code from a list of Qt designer ui files
0d857519a4c9 add Qt libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    23
find_package(Qt5Widgets CONFIG REQUIRED) # Find the QtWidgets library
10
a6a036bc3857 add Qt Charts library using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 8
diff changeset
    24
find_package(Qt5Charts CONFIG REQUIRED)
3
0d857519a4c9 add Qt libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    25
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    26
# Relpipe libraries:
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    27
INCLUDE(FindPkgConfig)
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    28
pkg_check_modules (RELPIPE_LIB_READER relpipe-lib-reader.cpp relpipe-lib-cli.cpp)
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    29
include_directories(${RELPIPE_LIB_READER_INCLUDE_DIRS})  
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    30
link_directories(${RELPIPE_LIB_READER_LIBRARY_DIRS})
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    31
1
0e791c64f38b add ASan AddressSanitizer to detect memory leaks
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    32
# Add ASan AddressSanitizer
0e791c64f38b add ASan AddressSanitizer to detect memory leaks
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    33
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
0e791c64f38b add ASan AddressSanitizer to detect memory leaks
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    34
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
0e791c64f38b add ASan AddressSanitizer to detect memory leaks
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    35
# From ASan wiki: "To get nicer stack traces in error messages add -fno-omit-frame-pointer."
0e791c64f38b add ASan AddressSanitizer to detect memory leaks
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    36
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    37
# Executable output:
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    38
add_executable(
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    39
	${EXECUTABLE_FILE}
38
129b8cca9b98 fix typo: Hadler → Handler
František Kučera <franta-hg@frantovo.cz>
parents: 33
diff changeset
    40
	QtRelationalReaderStringHandler.h # QObjects must be listed here (including them from other files is not enough)
28
04f1ac8a931b Qt Charts: first working version
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    41
	RelpipeChartWidget.h
23
ff4a1c07a481 use our own QAbstractTableModel and a QTableView instead of the QTableWidget
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    42
	RelpipeTableModel.h
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    43
	RelpipeChartMainWindow.ui
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    44
	RelpipeChartMainWindow.cpp
30
23354fc917f4 fix names
František Kučera <franta-hg@frantovo.cz>
parents: 29
diff changeset
    45
	relpipe-out-gui.cpp
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    46
)
2
7ba3ae8cf1fc add relpipe pkg-config libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    47
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    48
# Link libraries:
2
7ba3ae8cf1fc add relpipe pkg-config libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    49
target_link_libraries(${EXECUTABLE_FILE} ${RELPIPE_LIB_READER_LIBRARIES})
3
0d857519a4c9 add Qt libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    50
target_link_libraries(${EXECUTABLE_FILE} Qt5::Widgets)
10
a6a036bc3857 add Qt Charts library using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 8
diff changeset
    51
target_link_libraries(${EXECUTABLE_FILE} Qt5::Charts)
33
ec98d2e080a0 cmake: install
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    52
set_property(TARGET ${EXECUTABLE_FILE} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
8
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    53
33
ec98d2e080a0 cmake: install
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    54
install(TARGETS ${EXECUTABLE_FILE} DESTINATION bin)
8
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    55
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    56
# Print all variables:
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    57
#macro(print_all_variables)
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    58
#	message(STATUS "print_all_variables------------------------------------------{")
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    59
#	get_cmake_property(_variableNames VARIABLES)
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    60
#	foreach (_variableName ${_variableNames})
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    61
#		message(STATUS "${_variableName}=${${_variableName}}")
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    62
#	endforeach()
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    63
#	message(STATUS "print_all_variables------------------------------------------}")
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    64
#endmacro()
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    65
#
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    66
#print_all_variables()