src/CMakeLists.txt
author František Kučera <franta-hg@frantovo.cz>
Sat, 29 Sep 2018 00:43:16 +0200
branchv_0
changeset 13 c84042d014c9
parent 10 a6a036bc3857
child 23 ff4a1c07a481
permissions -rw-r--r--
background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
7ba3ae8cf1fc add relpipe pkg-config libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
     1
set(EXECUTABLE_FILE "relpipe-out-chart")
7ba3ae8cf1fc add relpipe pkg-config libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
     2
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
     3
# Qt libraries:
3
0d857519a4c9 add Qt libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
     4
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
     5
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
     6
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
     7
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
     8
find_package(Qt5Charts CONFIG REQUIRED)
3
0d857519a4c9 add Qt libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
     9
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    10
# Relpipe libraries:
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    11
INCLUDE(FindPkgConfig)
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    12
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
    13
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
    14
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
    15
1
0e791c64f38b add ASan AddressSanitizer to detect memory leaks
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    16
# Add ASan AddressSanitizer
0e791c64f38b add ASan AddressSanitizer to detect memory leaks
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    17
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
    18
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
    19
# 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
    20
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    21
# Executable output:
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    22
add_executable(
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    23
	${EXECUTABLE_FILE}
13
c84042d014c9 background thread for STDIN reading + proxy with signals/slots for passing data to the GUI thread
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    24
	QtRelationalReaderStringHadler.h # QObjects must be listed here (including them from other files is not enough)
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    25
	RelpipeChartMainWindow.ui
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    26
	RelpipeChartMainWindow.cpp
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    27
	relpipe-out-chart.cpp
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    28
)
2
7ba3ae8cf1fc add relpipe pkg-config libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    29
4
1622c087f3ea add main window, compile Qt .ui file
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
    30
# Link libraries:
2
7ba3ae8cf1fc add relpipe pkg-config libraries using cmake
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    31
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
    32
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
    33
target_link_libraries(${EXECUTABLE_FILE} Qt5::Charts)
8
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    34
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    35
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    36
# 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
    37
#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
    38
#	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
    39
#	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
    40
#	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
    41
#		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
    42
#	endforeach()
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    43
#	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
    44
#endmacro()
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    45
#
48fbdacec974 cmake: example of macro for printing all cmake variables
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    46
#print_all_variables()