src/CMakeLists.txt
branchv_0
changeset 0 37aa134ae57b
child 1 2a3e9f07c128
equal deleted inserted replaced
-1:000000000000 0:37aa134ae57b
       
     1 # Spacenav Demo Qt
       
     2 # Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info)
       
     3 #
       
     4 # This program is free software: you can redistribute it and/or modify
       
     5 # it under the terms of the GNU General Public License as published by
       
     6 # the Free Software Foundation, either version 3 of the License, or
       
     7 # (at your option) any later version.
       
     8 #
       
     9 # This program is distributed in the hope that it will be useful,
       
    10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
       
    12 # GNU General Public License for more details.
       
    13 #
       
    14 # You should have received a copy of the GNU General Public License
       
    15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
       
    16 
       
    17 set(EXECUTABLE_FILE "spacenav-demo-qt")
       
    18 
       
    19 # Qt libraries:
       
    20 set(CMAKE_INCLUDE_CURRENT_DIR ON) # Find includes in corresponding build directories
       
    21 set(CMAKE_AUTOMOC ON) # Instruct CMake to run moc automatically when needed
       
    22 set(CMAKE_AUTOUIC ON) # Create code from a list of Qt designer ui files
       
    23 find_package(Qt5Widgets CONFIG REQUIRED) # Find the QtWidgets library
       
    24 # find_package(Qt5Charts CONFIG REQUIRED)
       
    25 
       
    26 # Add ASan AddressSanitizer
       
    27 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
       
    28 set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
       
    29 # From ASan wiki: "To get nicer stack traces in error messages add -fno-omit-frame-pointer."
       
    30 
       
    31 # Executable output:
       
    32 add_executable(
       
    33 	${EXECUTABLE_FILE}
       
    34 	# QObjects must be listed here (including them from other files is not enough)
       
    35 	spacenav-demo-qt.cpp
       
    36 )
       
    37 
       
    38 # Link libraries:
       
    39 target_link_libraries(${EXECUTABLE_FILE} -lX11 -lm -lspnav)
       
    40 target_link_libraries(${EXECUTABLE_FILE} Qt5::Widgets)
       
    41 # target_link_libraries(${EXECUTABLE_FILE} Qt5::Charts)
       
    42 set_property(TARGET ${EXECUTABLE_FILE} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
       
    43 
       
    44 install(TARGETS ${EXECUTABLE_FILE} DESTINATION bin)
       
    45 
       
    46 # Print all variables:
       
    47 #macro(print_all_variables)
       
    48 #	message(STATUS "print_all_variables------------------------------------------{")
       
    49 #	get_cmake_property(_variableNames VARIABLES)
       
    50 #	foreach (_variableName ${_variableNames})
       
    51 #		message(STATUS "${_variableName}=${${_variableName}}")
       
    52 #	endforeach()
       
    53 #	message(STATUS "print_all_variables------------------------------------------}")
       
    54 #endmacro()
       
    55 #
       
    56 #print_all_variables()