src/CMakeLists.txt
author František Kučera <franta-hg@frantovo.cz>
Wed, 19 Dec 2018 23:10:18 +0100
branchv_0
changeset 11 24e4b4cd8982
parent 10 58cf7b021837
child 19 3cc1b9be97bc
permissions -rw-r--r--
builds with cmake 3.7.2 (e.g. on Debian GNU/Linux 9.6)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
# Relational pipes
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
# Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
#
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
# This program is free software: you can redistribute it and/or modify
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
# it under the terms of the GNU General Public License as published by
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
# the Free Software Foundation, either version 3 of the License, or
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
# (at your option) any later version.
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
#
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
# This program is distributed in the hope that it will be useful,
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
# GNU General Public License for more details.
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
#
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
# You should have received a copy of the GNU General Public License
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
# along with this program. If not, see <http://www.gnu.org/licenses/>.
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
set(EXECUTABLE_FILE "relpipe-in-fstab")
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
# Relpipe libraries:
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
INCLUDE(FindPkgConfig)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
pkg_check_modules (RELPIPE_LIBS relpipe-lib-writer.cpp relpipe-lib-cli.cpp)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
include_directories(${RELPIPE_LIBS_INCLUDE_DIRS})
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
link_directories(${RELPIPE_LIBS_LIBRARY_DIRS})
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
# Add ASan AddressSanitizer
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
# From ASan wiki: "To get nicer stack traces in error messages add -fno-omit-frame-pointer."
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
# Executable output:
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
add_executable(
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
	${EXECUTABLE_FILE}
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
	relpipe-in-fstab.cpp
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
)
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
# Link libraries:
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
target_link_libraries(${EXECUTABLE_FILE} ${RELPIPE_LIBS_LIBRARIES})
10
58cf7b021837 cmake: install
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    38
set_property(TARGET ${EXECUTABLE_FILE} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
58cf7b021837 cmake: install
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    39
58cf7b021837 cmake: install
František Kučera <franta-hg@frantovo.cz>
parents: 9
diff changeset
    40
install(TARGETS ${EXECUTABLE_FILE} DESTINATION bin)