From 4ca003ec8be536ca1e4fdb84e4d0490a7b519fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Wed, 9 Oct 2019 14:29:38 +0300 Subject: [PATCH] CMake scripts for finding GMP Former-commit-id: 7ac8c4899598b44afa36300dd962a2173c07d1c1 --- CMakeLists.txt | 1 + cmake-scripts/COPYING-CMAKE-SCRIPTS | 22 ++++++++++++++++++++++ cmake-scripts/FindGMP.cmake | 23 +++++++++++++++++++++++ cmake-scripts/ORIGINS | 3 +++ qpms/CMakeLists.txt | 1 + 5 files changed, 50 insertions(+) create mode 100644 cmake-scripts/COPYING-CMAKE-SCRIPTS create mode 100644 cmake-scripts/FindGMP.cmake create mode 100644 cmake-scripts/ORIGINS diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f80c81..5d55f0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.0.2) +set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake-scripts") include(CMakeAddFortranSubdirectory) include(version.cmake) include(GNUInstallDirs) diff --git a/cmake-scripts/COPYING-CMAKE-SCRIPTS b/cmake-scripts/COPYING-CMAKE-SCRIPTS new file mode 100644 index 0000000..4b41776 --- /dev/null +++ b/cmake-scripts/COPYING-CMAKE-SCRIPTS @@ -0,0 +1,22 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/cmake-scripts/FindGMP.cmake b/cmake-scripts/FindGMP.cmake new file mode 100644 index 0000000..17d175c --- /dev/null +++ b/cmake-scripts/FindGMP.cmake @@ -0,0 +1,23 @@ +# Try to find the GMP librairies +# GMP_FOUND - system has GMP lib +# GMP_INCLUDE_DIR - the GMP include directory +# GMP_LIBRARIES - Libraries needed to use GMP + +# Copyright (c) 2006, Laurent Montel, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +if (GMP_INCLUDE_DIR AND GMP_LIBRARIES) + # Already in cache, be silent + set(GMP_FIND_QUIETLY TRUE) +endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES) + +find_path(GMP_INCLUDE_DIR NAMES gmp.h ) +find_library(GMP_LIBRARIES NAMES gmp libgmp) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES) + +mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES) diff --git a/cmake-scripts/ORIGINS b/cmake-scripts/ORIGINS new file mode 100644 index 0000000..8ba518f --- /dev/null +++ b/cmake-scripts/ORIGINS @@ -0,0 +1,3 @@ +The FindGMP module comes from KDE's Extra CMake Modules v5.62.0, see: +- https://api.kde.org/ecm/ +- https://cgit.kde.org/extra-cmake-modules.git/ diff --git a/qpms/CMakeLists.txt b/qpms/CMakeLists.txt index 575aca8..856c41e 100644 --- a/qpms/CMakeLists.txt +++ b/qpms/CMakeLists.txt @@ -2,6 +2,7 @@ find_package(GSL 2.0 REQUIRED) find_package(BLAS REQUIRED) find_package(LAPACK REQUIRED) +find_package(GMP REQUIRED) #includes