Skip to content

Commit 37739f3

Browse files
rsomla1bkandasa
authored andcommitted
cmake: Clean up bits related to building with WolfSSL
(cherry picked from commit 86d638ec8c22d9abfda72a840eee70a177e557e7)
1 parent c16f264 commit 37739f3

File tree

2 files changed

+41
-45
lines changed

2 files changed

+41
-45
lines changed

cdk/extra/wolfssl/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,3 @@ SET(WOLFCRYPT_SOURCES ${WOLFCRYPT_SOURCE_DIR}/src/aes.c
148148
# misc.c is not compiled in since using INLINE
149149

150150
ADD_LIBRARY(wolfcrypt ${WOLFCRYPT_SOURCES})
151-
152-
IF(MSVC)
153-
INSTALL_DEBUG_TARGET(wolfcrypt DESTINATION ${INSTALL_LIBDIR}/debug)
154-
INSTALL_DEBUG_TARGET(wolfssl DESTINATION ${INSTALL_LIBDIR}/debug)
155-
ENDIF()

testapp/CMakeLists.txt

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ option(BUILD_STATIC "Link statically with the connector library" OFF)
8686

8787
if(BUILD_STATIC)
8888
message("Linking statically")
89-
add_definitions(-DSTATIC_CONCPP)
9089
endif()
9190

9291
option(STATIC_MSVCRT "Use static MSVC runtime library" OFF)
@@ -167,6 +166,9 @@ message("Looking for connector libraries here: ${CONCPP_STATIC_LIB_DIR}")
167166

168167
message("Looking for the main library ${libconcpp_name}")
169168

169+
unset(CONCPP_LIB CACHE)
170+
unset(CONCPP_LIB_DEBUG CACHE)
171+
170172
find_library(CONCPP_LIB NAMES ${libconcpp_name}
171173
PATHS "${CONCPP_STATIC_LIB_DIR}"
172174
NO_DEFAULT_PATH
@@ -188,29 +190,37 @@ endif()
188190

189191
if(CONCPP_LIB)
190192
list(APPEND CONCPP_LIBS optimized "${CONCPP_LIB}")
191-
if(NOT CONCPP_LIB_DEBUG AND NOT WIN32)
192-
message(WARNING "Using generic library also for debug builds")
193-
list(APPEND CONCPP_LIBS general "${CONCPP_LIB}")
194-
else()
195-
message(WARNING "Could not find debug libraries, building in debug mode will not work")
193+
if(NOT CONCPP_LIB_DEBUG)
194+
if(WIN32 AND BUILD_STATIC)
195+
message(WARNING "Could not find debug libraries, building in debug mode will not work")
196+
else()
197+
message(WARNING "Using generic library also for debug builds")
198+
list(APPEND CONCPP_LIBS general "${CONCPP_LIB}")
199+
endif()
196200
endif()
197201
endif()
198202

199203
if(CONCPP_LIB_DEBUG)
200204
list(APPEND CONCPP_LIBS debug "${CONCPP_LIB_DEBUG}")
201-
if(NOT CONCPP_LIB AND NOT WIN32)
202-
message(WARNING "Using debug library also for non-debug builds")
203-
list(APPEND CONCPP_LIBS general "${CONCPP_LIB_DEBUG}")
204-
else()
205-
message(WARNING "Only debug libraries found, building in release mode will not work")
205+
if(NOT CONCPP_LIB)
206+
if(WIN32 AND BUILD_STATIC)
207+
message(WARNING "Only debug libraries found, building in release mode will not work")
208+
else()
209+
message(WARNING "Using debug library also for non-debug builds")
210+
list(APPEND CONCPP_LIBS general "${CONCPP_LIB_DEBUG}")
211+
endif()
206212
endif()
207213
endif()
208214

209215
message("Using Connector/C++ 8.0 libraries: ${CONCPP_LIBS}")
210216

217+
if(WITH_JDBC)
211218

212219
message("Looking for the legacy library ${libconcpp_jdbc_name}")
213220

221+
unset(CONCPP_JDBC CACHE)
222+
unset(CONCPP_JDBC_DEBUG CACHE)
223+
214224
find_library(CONCPP_JDBC NAMES ${libconcpp_jdbc_name}
215225
PATHS "${CONCPP_STATIC_LIB_DIR}"
216226
NO_DEFAULT_PATH
@@ -233,26 +243,32 @@ endif()
233243

234244
if(CONCPP_JDBC)
235245
list(APPEND CONCPP_JDBC_LIBS optimized "${CONCPP_JDBC}")
236-
if(NOT CONCPP_JDBC_DEBUG AND NOT WIN32)
237-
message(WARNING "Using generic library also for debug builds")
238-
list(APPEND CONCPP_JDBC_LIBS general "${CONCPP_JDBC}")
239-
else()
240-
message(WARNING "Could not find debug libraries, building in debug mode will not work")
246+
if(NOT CONCPP_JDBC_DEBUG)
247+
if(WIN32 AND BUILD_STATIC)
248+
message(WARNING "Could not find debug libraries, building in debug mode will not work")
249+
else()
250+
message(WARNING "Using generic library also for debug builds")
251+
list(APPEND CONCPP_JDBC_LIBS general "${CONCPP_JDBC}")
252+
endif()
241253
endif()
242254
endif()
243255

244256
if(CONCPP_JDBC_DEBUG)
245257
list(APPEND CONCPP_JDBC_LIBS debug "${CONCPP_JDBC_DEBUG}")
246-
if(NOT CONCPP_JDBC AND NOT WIN32)
247-
message(WARNING "Using debug library also for non-debug builds")
248-
list(APPEND CONCPP_JDBC_LIBS general "${CONCPP_JDBC_DEBUG}")
249-
else()
250-
message(WARNING "Only debug libraries found, building in release mode will not work")
258+
if(NOT CONCPP_JDBC)
259+
if(WIN32 AND BUILD_STATIC)
260+
message(WARNING "Only debug libraries found, building in release mode will not work")
261+
else()
262+
message(WARNING "Using debug library also for non-debug builds")
263+
list(APPEND CONCPP_JDBC_LIBS general "${CONCPP_JDBC_DEBUG}")
264+
endif()
251265
endif()
252266
endif()
253267

254268
message("Using Connector/C++ 8.0 legacy libraries: ${CONCPP_JDBC_LIBS}")
255269

270+
endif(WITH_JDBC)
271+
256272

257273
#
258274
# Connector/C++ requires pthread library on Unix. Legacy connector needs
@@ -282,25 +298,6 @@ endif()
282298
# link to them too (however, no need to do it on Windows).
283299
#
284300

285-
if(NOT WIN32)
286-
message("@@@ NOT WIN32")
287-
endif()
288-
289-
if(BUILD_STATIC)
290-
message("@@@ BUILD_STATIC")
291-
endif()
292-
293-
if(NOT WITH_SSL)
294-
message("@@@ NOT WITH_SSL")
295-
endif()
296-
297-
message("@@@ FILE ${WITH_SSL}/wolfssl/openssl/ssl.h")
298-
299-
if(NOT EXISTS ${WITH_SSL}/wolfssl/openssl/ssl.h)
300-
message("@@@ NOT EXISTS ${WITH_SSL}/wolfssl/openssl/ssl.h")
301-
endif()
302-
303-
304301
if(NOT WIN32 AND BUILD_STATIC AND (NOT WITH_SSL OR
305302
NOT EXISTS ${WITH_SSL}/wolfssl/openssl/ssl.h))
306303
list(APPEND CONCPP_LIBS ssl crypto)
@@ -413,6 +410,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG run/debug)
413410

414411
include_directories(${CONCPP_INCLUDE_DIR})
415412

413+
if(BUILD_STATIC)
414+
add_definitions(-DSTATIC_CONCPP)
415+
endif()
416+
416417
#
417418
# Note: Adding this so that bundled libraries such as openSSL can be found
418419
# at link time in case they are not installed on the system.

0 commit comments

Comments
 (0)