@@ -86,7 +86,6 @@ option(BUILD_STATIC "Link statically with the connector library" OFF)
86
86
87
87
if (BUILD_STATIC )
88
88
message ("Linking statically" )
89
- add_definitions (-DSTATIC_CONCPP )
90
89
endif ()
91
90
92
91
option (STATIC_MSVCRT "Use static MSVC runtime library" OFF )
@@ -167,6 +166,9 @@ message("Looking for connector libraries here: ${CONCPP_STATIC_LIB_DIR}")
167
166
168
167
message ("Looking for the main library ${libconcpp_name} " )
169
168
169
+ unset (CONCPP_LIB CACHE )
170
+ unset (CONCPP_LIB_DEBUG CACHE )
171
+
170
172
find_library (CONCPP_LIB NAMES ${libconcpp_name}
171
173
PATHS "${CONCPP_STATIC_LIB_DIR} "
172
174
NO_DEFAULT_PATH
@@ -188,29 +190,37 @@ endif()
188
190
189
191
if (CONCPP_LIB )
190
192
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 ()
196
200
endif ()
197
201
endif ()
198
202
199
203
if (CONCPP_LIB_DEBUG )
200
204
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 ()
206
212
endif ()
207
213
endif ()
208
214
209
215
message ("Using Connector/C++ 8.0 libraries: ${CONCPP_LIBS} " )
210
216
217
+ if (WITH_JDBC )
211
218
212
219
message ("Looking for the legacy library ${libconcpp_jdbc_name} " )
213
220
221
+ unset (CONCPP_JDBC CACHE )
222
+ unset (CONCPP_JDBC_DEBUG CACHE )
223
+
214
224
find_library (CONCPP_JDBC NAMES ${libconcpp_jdbc_name}
215
225
PATHS "${CONCPP_STATIC_LIB_DIR} "
216
226
NO_DEFAULT_PATH
@@ -233,26 +243,32 @@ endif()
233
243
234
244
if (CONCPP_JDBC )
235
245
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 ()
241
253
endif ()
242
254
endif ()
243
255
244
256
if (CONCPP_JDBC_DEBUG )
245
257
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 ()
251
265
endif ()
252
266
endif ()
253
267
254
268
message ("Using Connector/C++ 8.0 legacy libraries: ${CONCPP_JDBC_LIBS} " )
255
269
270
+ endif (WITH_JDBC )
271
+
256
272
257
273
#
258
274
# Connector/C++ requires pthread library on Unix. Legacy connector needs
@@ -282,25 +298,6 @@ endif()
282
298
# link to them too (however, no need to do it on Windows).
283
299
#
284
300
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
-
304
301
if (NOT WIN32 AND BUILD_STATIC AND (NOT WITH_SSL OR
305
302
NOT EXISTS ${WITH_SSL} /wolfssl/openssl/ssl.h ))
306
303
list (APPEND CONCPP_LIBS ssl crypto )
@@ -413,6 +410,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG run/debug)
413
410
414
411
include_directories (${CONCPP_INCLUDE_DIR} )
415
412
413
+ if (BUILD_STATIC )
414
+ add_definitions (-DSTATIC_CONCPP )
415
+ endif ()
416
+
416
417
#
417
418
# Note: Adding this so that bundled libraries such as openSSL can be found
418
419
# at link time in case they are not installed on the system.
0 commit comments