BayesNet/CMakeLists.txt

52 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.20)
project(BayesNet
VERSION 0.1.0
DESCRIPTION "Bayesian Network and basic classifiers Library."
HOMEPAGE_URL "https://github.com/rmontanana/bayesnet"
LANGUAGES CXX
)
find_package(Torch REQUIRED)
if (POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif ()
# Global CMake variables
# ----------------------
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
# Options
# -------
option(ENABLE_CLANG_TIDY "Enable to add clang tidy." OFF)
option(ENABLE_TESTING "Unit testing build" ON)
option(CODE_COVERAGE "Collect coverage from test library" ON)
set(CMAKE_BUILD_TYPE "Debug")
# Subdirectories
# --------------
add_subdirectory(config)
add_subdirectory(src)
add_subdirectory(sample)
# Testing
# -------
if (ENABLE_TESTING)
enable_testing()
#if (CODE_COVERAGE)
SET(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
SET(GCC_COVERAGE_LINK_FLAGS "--coverage")
#endif (CODE_COVERAGE)
find_package(Catch2 3 REQUIRED)
include(CTest)
include(Catch)
add_subdirectory(tests)
endif (ENABLE_TESTING)