-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description This PR was triggered by the failures in #349 and its purpose is to better isolate the changes into separate PRs. - cda-tum/mqt-core#515 has dropped the submodules in `mqt-core` and replaced them with `FetchContent`. As such, the `googletest` test dependency is no longer available at its typical location. Consequently, this PR now also uses `FetchContent` to get `googletest`. In a future PR, this will most likely be extended to the `mqt-core` submodule as well. This should unblock #349. ## Checklist: <!--- This checklist serves as a reminder of a couple of things that ensure your pull request will be merged swiftly. --> - [x] The pull request only contains commits that are related to it. - [x] I have added appropriate tests and documentation. - [x] I have made sure that all CI jobs on GitHub pass. - [x] The pull request introduces no new warnings and follows the project's style guidelines. --------- Signed-off-by: burgholzer <[email protected]>
- Loading branch information
1 parent
63e1b9e
commit 1ab1ffa
Showing
10 changed files
with
117 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Declare all external dependencies and make sure that they are available. | ||
|
||
include(FetchContent) | ||
set(FETCH_PACKAGES "") | ||
|
||
# A macro to declare a dependency that takes into account the different CMake | ||
# versions and the features that they make available. In particular: - CMake | ||
# 3.24 introduced the `FIND_PACKAGE_ARGS` option to `FetchContent` which allows | ||
# to combine `FetchContent_Declare` and `find_package` in a single call. - CMake | ||
# 3.25 introduced the `SYSTEM` option to `FetchContent_Declare` which marks the | ||
# dependency as a system dependency. This is useful to avoid compiler warnings | ||
# from external header only libraries. - CMake 3.28 introduced the | ||
# `EXCLUDE_FROM_ALL` option to `FetchContent_Declare` which allows to exclude | ||
# all targets from the dependency from the `all` target. | ||
macro(DECLARE_DEPENDENCY) | ||
cmake_parse_arguments(DEPENDENCY "SYSTEM;EXCLUDE_FROM_ALL" | ||
"NAME;URL;MD5;MIN_VERSION;ALT_NAME" "" ${ARGN}) | ||
set(ADDITIONAL_OPTIONS "") | ||
if(DEPENDENCY_SYSTEM AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.25) | ||
list(APPEND ADDITIONAL_OPTIONS SYSTEM) | ||
endif() | ||
if(DEPENDENCY_EXCLUDE_FROM_ALL AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.28) | ||
list(APPEND ADDITIONAL_OPTIONS EXCLUDE_FROM_ALL) | ||
endif() | ||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28) | ||
FetchContent_Declare( | ||
${DEPENDENCY_NAME} | ||
URL ${DEPENDENCY_URL} | ||
URL_MD5 ${DEPENDENCY_MD5} | ||
${ADDITIONAL_OPTIONS} FIND_PACKAGE_ARGS ${DEPENDENCY_MIN_VERSION} NAMES | ||
${DEPENDENCY_ALT_NAME}) | ||
list(APPEND FETCH_PACKAGES ${DEPENDENCY_NAME}) | ||
elseif(CMAKE_VERSION VERSION_GREATER_EQUAL 3.25) | ||
FetchContent_Declare( | ||
${DEPENDENCY_NAME} | ||
URL ${DEPENDENCY_URL} | ||
URL_MD5 ${DEPENDENCY_MD5} | ||
${ADDITIONAL_OPTIONS} FIND_PACKAGE_ARGS ${DEPENDENCY_MIN_VERSION} NAMES | ||
${DEPENDENCY_ALT_NAME}) | ||
list(APPEND FETCH_PACKAGES ${DEPENDENCY_NAME}) | ||
elseif(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24) | ||
FetchContent_Declare( | ||
${DEPENDENCY_NAME} | ||
URL ${DEPENDENCY_URL} | ||
URL_MD5 ${DEPENDENCY_MD5} | ||
${ADDITIONAL_OPTIONS} FIND_PACKAGE_ARGS ${DEPENDENCY_MIN_VERSION} NAMES | ||
${DEPENDENCY_ALT_NAME}) | ||
list(APPEND FETCH_PACKAGES ${DEPENDENCY_NAME}) | ||
else() | ||
# try to get the system installed version | ||
find_package(${DEPENDENCY_NAME} ${DEPENDENCY_MIN_VERSION} QUIET NAMES | ||
${DEPENDENCY_ALT_NAME}) | ||
if(NOT ${DEPENDENCY_NAME}_FOUND) | ||
FetchContent_Declare( | ||
${DEPENDENCY_NAME} | ||
URL ${DEPENDENCY_URL} | ||
URL_MD5 ${DEPENDENCY_MD5}) | ||
list(APPEND FETCH_PACKAGES ${DEPENDENCY_NAME}) | ||
endif() | ||
endif() | ||
endmacro() | ||
|
||
if(BUILD_MQT_QCEC_TESTS) | ||
set(gtest_force_shared_crt # cmake-lint: disable=C0103 | ||
ON | ||
CACHE BOOL "" FORCE) | ||
declare_dependency( | ||
NAME | ||
googletest | ||
URL | ||
https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz | ||
MD5 | ||
c8340a482851ef6a3fe618a082304cfc | ||
MIN_VERSION | ||
1.14.0 | ||
ALT_NAME | ||
GTest | ||
SYSTEM | ||
EXCLUDE_FROM_ALL) | ||
endif() | ||
|
||
# Make all declared dependencies available. | ||
FetchContent_MakeAvailable(${FETCH_PACKAGES}) |
Submodule mqt-core
updated
76 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters