CMakeLists.txt 2.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 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
########################################################################
# CMake build script for PacBio pbcopper library.
########################################################################
cmake_policy(SET CMP0048 NEW)  # lets us set version in project()
cmake_minimum_required(VERSION 3.0)

project(pbcopper VERSION 0.0.1 LANGUAGES CXX C)
enable_testing()

# project options
option(pbcopper_build_shared    "Build pbcopper as a shared library."         OFF)
option(pbcopper_use_ccache      "Build pbcopper using ccache, if available."  ON)
option(pbcopper_build_tests     "Build pbcopper tests."                       ON)
option(pbcopper_build_docs      "Build pbcopper docs."                        ON)
option(pbcopper_build_examples  "Build pbcopper examples."                    ON)

# project paths
set(pbcopper_RootDir       ${CMAKE_CURRENT_LIST_DIR})
set(pbcopper_DocsDir       ${pbcopper_RootDir}/docs)
set(pbcopper_IncludeDir    ${pbcopper_RootDir}/include)
set(pbcopper_SourceDir     ${pbcopper_RootDir}/src)
set(pbcopper_TestsDir      ${pbcopper_RootDir}/tests)
set(pbcopper_ThirdPartyDir ${pbcopper_RootDir}/third-party)

if(NOT pbcopper_OutputDir)
    set(pbcopper_OutputDir ${CMAKE_CURRENT_BINARY_DIR})
endif()

set(pbcopper_LibDir  ${pbcopper_OutputDir}/lib)
file(MAKE_DIRECTORY  ${pbcopper_LibDir})

# project configuration
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake ${CMAKE_MODULE_PATH})
include(pbcopper-compilerflags)
include(pbcopper-ccache)
include(pbcopper-dependencies)
include(pbcopper-libtype)

# config generation
include(pbcopper-gitsha1)
find_git_sha1(COPPER_GIT_SHA1)
configure_file(
    ${pbcopper_IncludeDir}/pbcopper/utility/Version.h.in
    ${CMAKE_BINARY_DIR}/generated/pbcopper/utility/Version.h
)

# main library
add_subdirectory(src)

# project extras - only build on demand
#
if (pbcopper_build_docs)
    add_subdirectory(docs)      # build with 'make doc' or 'make docs'
endif()

if (pbcopper_build_examples)
    add_subdirectory(examples)  # build with 'make examples'
endif()

if (pbcopper_build_tests)
    add_subdirectory(tests)
endif()