Skip to content

Commit 7662004

Browse files
Merge pull request DrTimothyAldenDavis#905 from mmuetzel/spex
SPEX: MPFR and GMP dependencies
2 parents 154c725 + 94380be commit 7662004

File tree

3 files changed

+8
-24
lines changed

3 files changed

+8
-24
lines changed

Example/CMakeLists.txt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ find_package ( SPEX 3.2.3 REQUIRED ) # requires GMP and MPFR
107107
find_package ( SPQR 4.3.4 REQUIRED )
108108
find_package ( UMFPACK 6.3.5 REQUIRED )
109109

110-
# for GMP and MPFR
111-
find_package ( MPFR 4.0.2 REQUIRED ) # from SPEX/cmake_modules
112-
find_package ( GMP 6.1.2 REQUIRED ) # from SPEX/cmake_modules
113-
114110
#-------------------------------------------------------------------------------
115111
# configure files
116112
#-------------------------------------------------------------------------------
@@ -510,8 +506,8 @@ endif ( )
510506
# other libraries
511507
#-------------------------------------------------------------------------------
512508

513-
# The "MY" library does not directly rely on the OpenMP, libm, BLAS, and
514-
# LAPACK, libraries. However, if you wish to create a library that uses those
509+
# The "MY" library does not directly rely on the OpenMP, libm, BLAS, LAPACK,
510+
# MPFR, and GMP libraries. However, if you wish to create a library that uses those
515511
# libraries, uncomment the corresponding section. These direct dependencies
516512
# are left out of the MY CMakeLists.txt, as a test for the other SuiteSparse
517513
# cmake build system, to ensure that the libraries should be linked via the
@@ -572,8 +568,6 @@ if ( 0 )
572568
endif ( )
573569
include_directories ( ${LAPACK_INCLUDE_DIRS} )
574570

575-
endif ( )
576-
577571
# MPFR:
578572
message ( STATUS "MPFR library: ${MPFR_LIBRARIES}" )
579573
if ( BUILD_SHARED_LIBS )
@@ -598,6 +592,8 @@ endif ( )
598592
endif ( )
599593
include_directories ( ${GMP_INCLUDE_DIR} )
600594

595+
endif ( )
596+
601597
#-------------------------------------------------------------------------------
602598
# installation location
603599
#-------------------------------------------------------------------------------

SPEX/cmake_modules/FindGMP.cmake

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ if ( NOT GMP_FOUND )
7373
PATH_SUFFIXES lib build
7474
)
7575

76-
# check if found
77-
if ( GMP_LIBRARY MATCHES ".*NOTFOUND" OR GMP_INCLUDE_DIR MATCHES ".*NOTFOUND" )
78-
set ( FOUND_IT false )
79-
else ( )
80-
set ( FOUND_IT true )
81-
endif ( )
82-
8376
# static gmp library
8477
if ( NOT MSVC )
8578
set ( save_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} )
@@ -105,7 +98,8 @@ if ( NOT GMP_FOUND )
10598
# look in the middle for 6.2.1 (/spackstuff/gmp-6.2.1-morestuff/libgmp.10.4.1)
10699
string ( REGEX MATCH "gmp-[0-9]+.[0-9]+.[0-9]+" GMP_VERSION1 ${GMP_LIBRARY} )
107100

108-
if ( NOT FOUND_IT )
101+
if ( (GMP_LIBRARY MATCHES ".*NOTFOUND" AND GMP_STATIC MATCHES ".*NOTFOUND")
102+
OR GMP_INCLUDE_DIR MATCHES ".*NOTFOUND" )
109103
# gmp has not been found
110104
set ( GMP_VERSION 0.0.0 )
111105
message ( WARNING "GMP not found")

SPEX/cmake_modules/FindMPFR.cmake

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,6 @@ if ( NOT MPFR_FOUND )
7171
PATH_SUFFIXES lib build
7272
)
7373

74-
# check if found
75-
if ( MPFR_LIBRARY MATCHES ".*NOTFOUND" OR MPFR_INCLUDE_DIR MATCHES ".*NOTFOUND" )
76-
set ( FOUND_IT false )
77-
else ( )
78-
set ( FOUND_IT true )
79-
endif ( )
80-
8174
# static mpfr library
8275
if ( NOT MSVC )
8376
set ( save_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} )
@@ -105,7 +98,8 @@ if ( NOT MPFR_FOUND )
10598
# look in the middle for 4.1.0 (/spackstuff/mpfr-4.1.0-morestuff/libmpfr.10.4.1)
10699
string ( REGEX MATCH "mpfr-[0-9]+.[0-9]+.[0-9]+" MPFR_VERSION1 ${MPFR_LIBRARY} )
107100

108-
if ( NOT FOUND_IT )
101+
if ( (MPFR_LIBRARY MATCHES ".*NOTFOUND" AND MPFR_STATIC MATCHES ".*NOTFOUND")
102+
OR MPFR_INCLUDE_DIR MATCHES ".*NOTFOUND" )
109103
# mpfr has not been found
110104
set ( MPFR_VERSION 0.0.0 )
111105
message ( WARNING "MPFR not found")

0 commit comments

Comments
 (0)