This repository was archived by the owner on Jun 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
60 lines (50 loc) · 1.83 KB
/
CMakeLists.txt
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
# set required cmake version
cmake_minimum_required(VERSION 3.19)
project(
zx
LANGUAGES CXX
VERSION 0.1
DESCRIPTION "ZX - An MQT library for working with ZX-diagrams")
# enable organization of targets into folders
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# configuration options
option(DEPLOY "Configure for deployment")
option(BINDINGS "Configure for building Python bindings")
option(COVERAGE "Configure for coverage report generation")
option(BUILD_ZX_TESTS "Also build tests for ZX library")
# build type settings
set(DEFAULT_BUILD_TYPE "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
set(CMAKE_BUILD_TYPE
"${default_build_type}"
CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel"
"RelWithDebInfo")
endif()
# check whether the submodule ``modulename`` is correctly cloned in the ``/extern`` directory.
macro(CHECK_SUBMODULE_PRESENT modulename)
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/extern/${modulename}/CMakeLists.txt")
message(
FATAL_ERROR
"${modulename} submodule not cloned properly. \
Please run `git submodule update --init --recursive` \
from the main project directory")
endif()
endmacro()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
check_submodule_present(boost/config)
check_submodule_present(boost/multiprecision)
set(BOOST_MP_STANDALONE ON)
find_package(GMP)
if(NOT GMP_FOUND)
message(NOTICE "Did not find GMP. Using Boost multiprecision library instead.")
endif()
# add main library code
add_subdirectory(src)
# add test code
if(BUILD_ZX_TESTS)
enable_testing()
include(GoogleTest)
add_subdirectory(test)
endif()