Files
mp-units/CMakeLists.txt

73 lines
2.4 KiB
CMake
Raw Normal View History

2018-08-22 12:11:19 +02:00
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.23)
2022-04-02 18:58:23 +02:00
project(mp-units-dev LANGUAGES CXX)
2018-08-22 12:11:19 +02:00
2021-03-13 19:53:09 +01:00
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
2018-08-22 12:11:19 +02:00
2023-06-21 10:55:18 +02:00
set(projectPrefix MP_UNITS_)
2021-11-05 23:25:20 +01:00
option(${projectPrefix}DEV_BUILD_LA "Build code depending on the linear algebra library" ON)
message(STATUS "${projectPrefix}DEV_BUILD_LA: ${${projectPrefix}DEV_BUILD_LA}")
# make sure that the file is being used as an entry point
include(modern_project_structure)
ensure_entry_point()
2021-05-08 18:28:49 +02:00
# use ccache if available
include(ccache)
enable_ccache(BASE_DIR ${PROJECT_SOURCE_DIR})
2021-05-08 18:28:49 +02:00
2021-03-30 13:15:47 +02:00
# enable include-what-you-use
option(${projectPrefix}DEV_IWYU "Enables include-what-you-use" OFF)
if(${projectPrefix}DEV_IWYU)
set(${projectPrefix}BUILD_AS_SYSTEM_HEADERS ON)
2021-03-30 13:15:47 +02:00
include(include-what-you-use)
2021-05-07 20:46:40 +02:00
enable_iwyu(
2021-03-30 13:15:47 +02:00
MAPPING_FILE "${PROJECT_SOURCE_DIR}/.mp-units.imp"
2022-04-02 18:58:23 +02:00
NO_FORWARD_DECLARATIONS QUOTED_INCLUDES_FIRST
2021-03-30 13:15:47 +02:00
MAX_LINE_LENGTH 120
NO_COMMENTS
)
2024-04-24 20:10:44 +02:00
else()
# set restrictive compilation warnings
# (some gcc warnings are not recognized by IWYU which is based on clang)
include(warnings)
set_warnings()
2021-03-30 13:15:47 +02:00
endif()
# enable_clang_tidy()
2018-08-22 12:11:19 +02:00
# add project code
add_subdirectory(src)
# add usage example
add_subdirectory(example)
2020-03-09 18:55:41 +01:00
2020-12-09 18:54:36 +01:00
# add unit tests
enable_testing()
2022-10-06 23:43:01 +01:00
add_subdirectory(test)