Skip to content
This repository was archived by the owner on Jul 2, 2025. It is now read-only.

Commit 99aa096

Browse files
authored
Link GMP dynamically in a consistent way. (#307)
1 parent 5f15cfb commit 99aa096

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ FetchContent_Declare(
5858

5959
# Relic related options
6060

61-
set(STBIN TRUE)
61+
set(STBIN "off" CACHE STRING "Relic - Build static binaries")
62+
6263
find_package(gmp)
6364
if (GMP_FOUND)
6465
message(STATUS "Found libgmp")
@@ -106,8 +107,6 @@ else()
106107
set(FP_QNRES "on" CACHE STRING "")
107108
endif()
108109

109-
set(STBIN "OFF" CACHE STRING "")
110-
111110
set(FP_METHD "INTEG;INTEG;INTEG;MONTY;LOWER;SLIDE" CACHE STRING "")
112111

113112
if(MSVC)

cmake_modules/Findgmp.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,18 @@ if(GMP_INCLUDES)
6868
endif()
6969
endif()
7070

71-
find_library(GMP_LIBRARIES gmp PATHS $ENV{GMPDIR} ${LIB_INSTALL_DIR})
71+
if(STBIN)
72+
set(_gmp_lib_name libgmp.a)
73+
else()
74+
set(_gmp_lib_name libgmp.so)
75+
endif()
76+
77+
find_library(GMP_LIBRARIES
78+
NAMES
79+
${_gmp_lib_name} gmp.lib libgmp-10 libgmp gmp
80+
PATHS
81+
$ENV{GMPDIR} ${LIB_INSTALL_DIR}
82+
)
7283

7384
include(FindPackageHandleStandardArgs)
7485
find_package_handle_standard_args(gmp DEFAULT_MSG

0 commit comments

Comments
 (0)