Skip to content

Commit 4767558

Browse files
committed
Add correct MPI provider defines to pkg-config cflags
Signed-off-by: Steffen Jaeckel <[email protected]>
1 parent 3f33ccf commit 4767558

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

CMakeLists.txt

+8-3
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ if(WITH_LTM)
137137
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_LTM)
138138
endif()
139139
target_link_libraries(${PROJECT_NAME} PUBLIC libtommath)
140-
list(APPEND MPI_PROVIDERS -ltommath)
140+
list(APPEND LTC_MPI_PROVIDERS_CFLAGS -DLTM_DESC)
141+
list(APPEND LTC_MPI_PROVIDERS_LIBS -ltommath)
141142
endif()
142143
# tomsfastmath
143144
if(WITH_TFM)
@@ -148,7 +149,8 @@ if(WITH_TFM)
148149
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_TFM)
149150
endif()
150151
target_link_libraries(${PROJECT_NAME} PUBLIC tomsfastmath)
151-
list(APPEND MPI_PROVIDERS -ltfm)
152+
list(APPEND LTC_MPI_PROVIDERS_CFLAGS -DTFM_DESC)
153+
list(APPEND LTC_MPI_PROVIDERS_LIBS -ltfm)
152154
endif()
153155
# GNU MP
154156
if(WITH_GMP)
@@ -159,9 +161,12 @@ if(WITH_GMP)
159161
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_GMP)
160162
endif()
161163
target_link_libraries(${PROJECT_NAME} PUBLIC ${GMP_LIBRARIES})
162-
list(APPEND MPI_PROVIDERS -lgmp)
164+
list(APPEND LTC_MPI_PROVIDERS_CFLAGS -DGMP_DESC)
165+
list(APPEND LTC_MPI_PROVIDERS_LIBS -lgmp)
163166
endif()
164167

168+
list(JOIN LTC_MPI_PROVIDERS_CFLAGS " " MPI_PROVIDERS_CFLAGS)
169+
list(JOIN LTC_MPI_PROVIDERS_LIBS " " MPI_PROVIDERS_LIBS)
165170

166171
#-----------------------------------------------------------------------------
167172
# demos&test targets

libtomcrypt.pc.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/@PROJECT_NAME@
66
Name: LibTomCrypt
77
Description: public domain open source cryptographic toolkit
88
Version: @PROJECT_VERSION@
9-
Libs: -L${libdir} -ltomcrypt @MPI_PROVIDERS@
10-
Cflags: -I${includedir}
9+
Libs: -L${libdir} -ltomcrypt @MPI_PROVIDERS_LIBS@
10+
Cflags: -I${includedir} @MPI_PROVIDERS_CFLAGS@

makefile.shared

+8-4
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,16 @@ endif
5555
include makefile_include.mk
5656

5757
ifneq ($(findstring -DLTM_DESC,$(LTC_CFLAGS)),)
58-
LTC_MPI_PROVIDERS += -ltommath
58+
LTC_MPI_PROVIDERS_CFLAGS += -DLTM_DESC
59+
LTC_MPI_PROVIDERS_LIBS += -ltommath
5960
endif
6061
ifneq ($(findstring -DTFM_DESC,$(LTC_CFLAGS)),)
61-
LTC_MPI_PROVIDERS += -ltfm
62+
LTC_MPI_PROVIDERS_CFLAGS += -DTFM_DESC
63+
LTC_MPI_PROVIDERS_LIBS += -ltfm
6264
endif
6365
ifneq ($(findstring -DGMP_DESC,$(LTC_CFLAGS)),)
64-
LTC_MPI_PROVIDERS += -lgmp
66+
LTC_MPI_PROVIDERS_CFLAGS += -DGMP_DESC
67+
LTC_MPI_PROVIDERS_LIBS += -lgmp
6568
endif
6669

6770
#ciphers come in two flavours... enc+dec and enc
@@ -90,7 +93,8 @@ $(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))
9093
install: $(call print-help,install,Installs the library + headers + pkg-config file) .common_install
9194
sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION_PC),' -e 's,@CMAKE_INSTALL_LIBDIR@,lib,' \
9295
-e 's,@CMAKE_INSTALL_INCLUDEDIR@/@PROJECT_NAME@,include/tomcrypt,' \
93-
-e 's,@MPI_PROVIDERS@,$(LTC_MPI_PROVIDERS),' libtomcrypt.pc.in > libtomcrypt.pc
96+
-e 's,@MPI_PROVIDERS_LIBS@,$(LTC_MPI_PROVIDERS_LIBS),' \
97+
-e 's,@MPI_PROVIDERS_CFLAGS@,$(LTC_MPI_PROVIDERS_CFLAGS),' libtomcrypt.pc.in > libtomcrypt.pc
9498
install -p -d $(DESTDIR)$(LIBPATH)/pkgconfig
9599
install -p -m 644 libtomcrypt.pc $(DESTDIR)$(LIBPATH)/pkgconfig/
96100

0 commit comments

Comments
 (0)