Select Git revision
CMakeLists.txt
-
Stéphane Del Pino authored
subrepo: subdir: "packages/kokkos" merged: "81aa135f" upstream: origin: "git@github.com:kokkos/kokkos.git" branch: "master" commit: "81aa135f" git-subrepo: version: "0.4.1" origin: "git@github.com:ingydotnet/git-subrepo.git" commit: "a04d8c2"
Stéphane Del Pino authoredsubrepo: subdir: "packages/kokkos" merged: "81aa135f" upstream: origin: "git@github.com:kokkos/kokkos.git" branch: "master" commit: "81aa135f" git-subrepo: version: "0.4.1" origin: "git@github.com:ingydotnet/git-subrepo.git" commit: "a04d8c2"
CMakeLists.txt 12.70 KiB
cmake_minimum_required (VERSION 3.4)
# CMake utils
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Forbids in-source builds
include(CheckNotInSources)
#------------------------------------------------------
#----------------- Main configuration -----------------
#------------------------------------------------------
# custom variable allowing to define version suffixes such as -rc*, -beta*, ...
set(PUGS_VERSION "0.4.1")
# deduce PUGS_SHORT_VERSION using regex
string(REGEX MATCH "^[0-9]+\.[0-9]+\.[0-9]+" PUGS_SHORT_VERSION ${PUGS_VERSION})
if("${PUGS_SHORT_VERSION}" STREQUAL "")
message(FATAL_ERROR "Unable to compute short version from PUGS_VERSION=${PUGS_VERSION}")
endif()
# set project version as PUGS_SHORT_VERSION
project (Pugs VERSION ${PUGS_SHORT_VERSION})
#------------------------------------------------------
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
#------------------------------------------------------
set(PUGS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(PUGS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
# Change RelWithDebInfo to compile assertions
SET("CMAKE_CXX_FLAGS_RELWITHDEBINFO"
"-g -O2"
CACHE STRING "Flags used by the compiler during release builds with debug info and assertions"
FORCE )
SET("CMAKE_C_FLAGS_RELWITHDEBINFO"
"-g -O2"
CACHE STRING "Flags used by the compiler during release builds with debug info and assertions"
FORCE )
# Add new build types
set(CMAKE_CXX_FLAGS_COVERAGE
"-g -O0 --coverage"
CACHE STRING "Flags used by the C++ compiler during coverage builds."
FORCE )
set(CMAKE_C_FLAGS_COVERAGE
"-g -O0 --coverage"
CACHE STRING "Flags used by the C compiler during coverage builds."
FORCE )
set(CMAKE_EXE_LINKER_FLAGS_COVERAGE
"--coverage"
CACHE STRING "Flags used for linking binaries during coverage builds."
FORCE )
set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
"--coverage"
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
FORCE )
mark_as_advanced(
CMAKE_CXX_FLAGS_COVERAGE
CMAKE_C_FLAGS_COVERAGE
CMAKE_EXE_LINKER_FLAGS_COVERAGE
CMAKE_SHARED_LINKER_FLAGS_COVERAGE )
if(CMAKE_BUILD_TYPE)
string(REGEX MATCH "(Debug|Release|RelWithDebInfo|MinSizeRel|Coverage)" VALID_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
if(NOT VALID_BUILD_TYPE)
message(FATAL_ERROR "Invalid CMAKE_BUILD_TYPE: '${CMAKE_BUILD_TYPE}'")