CMakeLists.txt 1.64 KB
Newer Older
James Clark's avatar
James Clark committed
1 2 3 4 5 6 7 8 9 10 11 12
#
# CMake packaging for BayesWave
# Copyright 2019  James Alexander Clark <james.clark@ligo.org>
# Based on CMake packaging for libframe & Frv by Duncan MacLeod <duncan.macleod@ligo.org>
#

# -- package info -----------

cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR)
project(
    bayeswave
    LANGUAGES C
James Clark's avatar
James Clark committed
13
    VERSION 1.0.6
James Clark's avatar
James Clark committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
    DESCRIPTION "LIGO/VIRGO burst analysis algorithm"
    HOMEPAGE_URL "https://git.ligo.org/lscsoft/bayeswave"
)

include(GNUInstallDirs)
include(CheckFunctionExists)
find_package(PkgConfig)
find_package(Git)

# -- build components -------

# C library | enable/disable with -DENABLE_C={yes,no} (default yes)
add_subdirectory(src)
#add_subdirectory(doc)

# -- packaging components ---

set(SPEC_IN "${CMAKE_CURRENT_SOURCE_DIR}/bayeswave.spec.in")
set(SPEC    "${CMAKE_CURRENT_SOURCE_DIR}/bayeswave.spec")
configure_file(${SPEC_IN} ${SPEC} @ONLY)

# -- build tarball ----------
#
# to build a source tarball:
#
# mkdir dist
# pushd dist
# cmake ..
# cmake --build . --target package_source
#

set(CPACK_PACKAGE_MAJOR ${${PROJECT_NAME}_MAJOR_VERSION})
set(CPACK_PACKAGE_MINOR ${${PROJECT_NAME}_MINOR_VERSION})
set(CPACK_PACKAGE_PATCH ${${PROJECT_NAME}_PATCH_VERSION})
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_MAJOR}.${CPACK_PACKAGE_MINOR}.${CPACK_PACKAGE_PATCH}")

set(CPACK_SOURCE_GENERATOR TXZ)
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${PROJECT_NAME}-${${PROJECT_NAME}_VERSION})
set(CPACK_SOURCE_IGNORE_FILES
    "/.*~$/"
    ".*~$"
    "\\\\.svn/"
    "\\\\.git"
    "build/"
    "CMakeFiles/"
    "CMakeCache.txt"
    "_CPack_Packages/"
    "\\\\.cmake"
    "Makefile"
    "\\\\.deps/"
    "autom4te.cache/"
    "\\\\.tar\\\\.xz"
)
include(CPack)