-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathExternalDependencies.cmake
86 lines (78 loc) · 2.73 KB
/
ExternalDependencies.cmake
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Declare all external dependencies and make sure that they are available.
include(FetchContent)
set(FETCH_PACKAGES "")
if(BUILD_MQT_QCEC_BINDINGS)
if(NOT SKBUILD)
# Manually detect the installed pybind11 package.
execute_process(
COMMAND "${Python_EXECUTABLE}" -m pybind11 --cmakedir
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE pybind11_DIR)
# Add the detected directory to the CMake prefix path.
list(APPEND CMAKE_PREFIX_PATH "${pybind11_DIR}")
endif()
# add pybind11 library
find_package(pybind11 2.13.5 CONFIG REQUIRED)
endif()
# cmake-format: off
set(MQT_CORE_VERSION 2.7.0
CACHE STRING "MQT Core version")
set(MQT_CORE_REV "9f885e4a47e3f65e380dbe855ef9fabcc5ed570e"
CACHE STRING "MQT Core identifier (tag, branch or commit hash)")
set(MQT_CORE_REPO_OWNER "cda-tum"
CACHE STRING "MQT Core repository owner (change when using a fork)")
# cmake-format: on
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
FetchContent_Declare(
mqt-core
GIT_REPOSITORY https://github.com/${MQT_CORE_REPO_OWNER}/mqt-core.git
GIT_TAG ${MQT_CORE_REV}
FIND_PACKAGE_ARGS ${MQT_CORE_VERSION})
list(APPEND FETCH_PACKAGES mqt-core)
else()
find_package(mqt-core ${MQT_CORE_VERSION} QUIET)
if(NOT mqt-core_FOUND)
FetchContent_Declare(
mqt-core
GIT_REPOSITORY https://github.com/${MQT_CORE_REPO_OWNER}/mqt-core.git
GIT_TAG ${MQT_CORE_REV})
list(APPEND FETCH_PACKAGES mqt-core)
endif()
endif()
if(BUILD_MQT_QCEC_TESTS)
set(gtest_force_shared_crt
ON
CACHE BOOL "" FORCE)
set(GTEST_VERSION
1.14.0
CACHE STRING "Google Test version")
set(GTEST_URL https://github.com/google/googletest/archive/refs/tags/v${GTEST_VERSION}.tar.gz)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
FetchContent_Declare(googletest URL ${GTEST_URL} FIND_PACKAGE_ARGS ${GTEST_VERSION} NAMES GTest)
list(APPEND FETCH_PACKAGES googletest)
else()
find_package(googletest ${GTEST_VERSION} QUIET NAMES GTest)
if(NOT googletest_FOUND)
FetchContent_Declare(googletest URL ${GTEST_URL})
list(APPEND FETCH_PACKAGES googletest)
endif()
endif()
endif()
if(BUILD_MQT_QCEC_BINDINGS)
# add pybind11_json library
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
FetchContent_Declare(
pybind11_json
GIT_REPOSITORY https://github.com/pybind/pybind11_json
FIND_PACKAGE_ARGS)
list(APPEND FETCH_PACKAGES pybind11_json)
else()
find_package(pybind11_json QUIET)
if(NOT pybind11_json_FOUND)
FetchContent_Declare(pybind11_json GIT_REPOSITORY https://github.com/pybind/pybind11_json)
list(APPEND FETCH_PACKAGES pybind11_json)
endif()
endif()
endif()
# Make all declared dependencies available.
FetchContent_MakeAvailable(${FETCH_PACKAGES})