diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 702dc3c36..6130e9893 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,8 @@ jobs: needs: change-detection if: fromJSON(needs.change-detection.outputs.run-cpp-tests) uses: cda-tum/mqt-workflows/.github/workflows/reusable-cpp-ci.yml@v1.0.0 + with: + cmake-args-macos: -DMQT_CORE_WITH_GMP=ON secrets: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/cmake/mqt-core-config.cmake.in b/cmake/mqt-core-config.cmake.in index 55575a49c..9666f5068 100644 --- a/cmake/mqt-core-config.cmake.in +++ b/cmake/mqt-core-config.cmake.in @@ -6,9 +6,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") include(CMakeFindDependencyMacro) find_dependency(nlohmann_json) -option(MQT_CORE_ZX_WITH_GMP "Library is configured to use GMP for ZX calculations" - @MQT_CORE_ZX_WITH_GMP@) -if(MQT_CORE_ZX_WITH_GMP) +option(MQT_CORE_WITH_GMP "Library is configured to use GMP" @MQT_CORE_WITH_GMP@) +if(MQT_CORE_WITH_GMP) find_dependency(GMP) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 526f2035c..e0516a00a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -184,7 +184,7 @@ if(MQT_CORE_INSTALL) configure_package_config_file( ${MQT_CORE_CMAKE_CONFIG_TEMPLATE} ${MQT_CORE_CMAKE_PROJECT_CONFIG_FILE} INSTALL_DESTINATION ${MQT_CORE_CONFIG_INSTALL_DIR} - PATH_VARS MQT_CORE_ZX_WITH_GMP + PATH_VARS MQT_CORE_WITH_GMP NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) write_basic_package_version_file( ${MQT_CORE_CMAKE_VERSION_CONFIG_FILE} diff --git a/src/zx/CMakeLists.txt b/src/zx/CMakeLists.txt index 290a78ecc..65475b3ce 100644 --- a/src/zx/CMakeLists.txt +++ b/src/zx/CMakeLists.txt @@ -51,18 +51,13 @@ if(NOT TARGET ${MQT_CORE_TARGET_NAME}-zx) target_link_libraries(${MQT_CORE_TARGET_NAME}-zx PUBLIC MQT::Core MQT::Multiprecision) target_link_libraries(${MQT_CORE_TARGET_NAME}-zx PRIVATE MQT::ProjectOptions MQT::ProjectWarnings) - find_package(GMP) - if(NOT GMP_FOUND) - message(NOTICE "Did not find GMP. Using Boost multiprecision library instead.") - endif() - # # link to GMP libraries if present - if(GMP_FOUND) + option(MQT_CORE_WITH_GMP "Whether to use GMP for multiprecision arithmetic" OFF) + if(MQT_CORE_WITH_GMP) + find_package(GMP REQUIRED) + # link to GMP libraries if present target_compile_definitions(${MQT_CORE_TARGET_NAME}-zx PUBLIC GMP) target_link_libraries(${MQT_CORE_TARGET_NAME}-zx PUBLIC GMP::gmp GMP::gmpxx) endif() - set(MQT_CORE_ZX_WITH_GMP - ${GMP_FOUND} - CACHE BOOL "Whether to use GMP for multiprecision arithmetic") # add MQT alias add_library(MQT::CoreZX ALIAS ${MQT_CORE_TARGET_NAME}-zx)