105 lines
3.3 KiB
CMake
105 lines
3.3 KiB
CMake
# git-journal - A git plugin to manage journal entries in git
|
|
#
|
|
# Copyright (c) 2023-2024 Sameer Rahmani <lxsameer@gnu.org>
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, version 2.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#A git plugin to manage journal entries in git
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
cmake_minimum_required(VERSION 3.19)
|
|
|
|
project(Serene
|
|
VERSION 1.0.0
|
|
DESCRIPTION "A modern typed Lisp."
|
|
LANGUAGES CXX C)
|
|
|
|
# Clangd command file
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
|
|
|
# =============================================================================
|
|
# Policies
|
|
# =============================================================================
|
|
cmake_policy(SET CMP0116 OLD)
|
|
|
|
# =============================================================================
|
|
# User Options
|
|
# =============================================================================
|
|
option(CPP_20_SUPPORT "C++20 Support" ON)
|
|
option(ENABLE_CCACHE "Enable ccache support" ON)
|
|
option(ENABLE_DOCS "Enable docs" OFF)
|
|
option(ENABLE_TESTS "Enable testing" OFF)
|
|
|
|
find_program(CLANG_TIDY_PATH NAMES clang-tidy REQUIRED)
|
|
find_program(iwyu NAMES include-what-you-use iwyu REQUIRED)
|
|
set(iwyu_path ${iwyu})
|
|
|
|
# Let's ensure -std=c++xx instead of -std=g++xx
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
|
set(MemoryCheckCommand "valgrind")
|
|
|
|
# Let's nicely support folders in IDEs
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
# Setup the basic compiler flags
|
|
add_compile_options(
|
|
-Wall
|
|
-Wextra
|
|
-Werror
|
|
-Wpedantic
|
|
-Wabstract-final-class
|
|
-Walloca
|
|
-Warray-bounds-pointer-arithmetic
|
|
-Warray-parameter
|
|
-Wassign-enum
|
|
-Wsign-conversion
|
|
-Wnon-virtual-dtor
|
|
-Wold-style-cast
|
|
-Wcast-align
|
|
-Wunused
|
|
-Woverloaded-virtual
|
|
-Wdouble-promotion
|
|
-Wformat=2)
|
|
|
|
add_link_options(-Wl,-Map=output.map)
|
|
|
|
# CCache support ==============================
|
|
if(ENABLE_CCACHE)
|
|
find_program(CCACHE_PROGRAM ccache)
|
|
|
|
if(CCACHE_PROGRAM)
|
|
message(STATUS "Found CCache")
|
|
set(CCACHE_MAXSIZE "" CACHE STRING "Size of ccache")
|
|
set(CCACHE_DIR "" CACHE STRING "Directory to keep ccached data")
|
|
set(CCACHE_PARAMS "CCACHE_CPP2=yes CCACHE_HASHDIR=yes"
|
|
CACHE STRING "Parameters to pass through to ccache")
|
|
|
|
set(CCACHE_PROGRAM "${CCACHE_PARAMS} ${CCACHE_PROGRAM}")
|
|
|
|
if (CCACHE_MAXSIZE)
|
|
set(CCACHE_PROGRAM "CCACHE_MAXSIZE=${CCACHE_MAXSIZE} ${CCACHE_PROGRAM}")
|
|
endif()
|
|
if (CCACHE_DIR)
|
|
set(CCACHE_PROGRAM "CCACHE_DIR=${CCACHE_DIR} ${CCACHE_PROGRAM}")
|
|
endif()
|
|
message(STATUS "Using CCACHE: ${CCACHE_PROGRAM}")
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_PROGRAM})
|
|
else()
|
|
message(FATAL_ERROR "Unable to find the program ccache. Set ENABLE_CCACHE to OFF")
|
|
endif()
|
|
endif()
|
|
|
|
if (ENABLE_DOCS)
|
|
add_subdirectory(docs)
|
|
endif()
|
|
|
|
add_subdirectory(git-journal)
|