@@ -40,26 +40,21 @@ user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
40
40
add_definitions ( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS )
41
41
add_definitions ( -DHUGE_SUPPORT -DGZ_SUPPORT )
42
42
43
- macro (DISABLE_WARNING W )
44
- MY_CHECK_AND_SET_COMPILER_FLAG ("-Wno-error=${W} " )
45
- MY_CHECK_AND_SET_COMPILER_FLAG ("-Wno-${W} " DEBUG )
46
- endmacro ()
47
43
48
44
#
49
45
# OS specific C flags, definitions and source files.
50
46
#
51
47
IF (UNIX )
52
48
MY_CHECK_AND_SET_COMPILER_FLAG ("-Wall -Wmissing-declarations" )
53
49
if (NOT WITH_WARNINGS )
54
- DISABLE_WARNING ("unused-function" )
55
- DISABLE_WARNING ("unused-variable" )
56
- DISABLE_WARNING ("unused-value" )
57
- DISABLE_WARNING ("parentheses" )
58
- DISABLE_WARNING ("strict-aliasing" )
59
- DISABLE_WARNING ("misleading-indentation" )
60
- DISABLE_WARNING ("format-truncation" )
61
- DISABLE_WARNING ("implicit-fallthrough" )
62
- DISABLE_WARNING ("type-limits" )
50
+ MY_CHECK_AND_SET_COMPILER_FLAG ("-Wno-unused-function" )
51
+ MY_CHECK_AND_SET_COMPILER_FLAG ("-Wno-unused-variable" )
52
+ MY_CHECK_AND_SET_COMPILER_FLAG ("-Wno-unused-value" )
53
+ MY_CHECK_AND_SET_COMPILER_FLAG ("-Wno-parentheses" )
54
+ MY_CHECK_AND_SET_COMPILER_FLAG ("-Wno-strict-aliasing" )
55
+ MY_CHECK_AND_SET_COMPILER_FLAG ("-Wno-misleading-indentation" )
56
+ MY_CHECK_AND_SET_COMPILER_FLAG ("-Wno-format-truncation" )
57
+ MY_CHECK_AND_SET_COMPILER_FLAG ("-Wno-implicit-fallthrough" )
63
58
endif (NOT WITH_WARNINGS )
64
59
65
60
add_definitions ( -DUNIX -DLINUX -DUBUNTU )
@@ -73,6 +68,10 @@ ELSE(NOT UNIX)
73
68
tabwmi.cpp tabwmi.h tabmac.cpp tabmac.h macutil.cpp macutil.h )
74
69
# Add exception handling to the CONNECT project)
75
70
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc" )
71
+ SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD" )
72
+ SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd" )
73
+ SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD" )
74
+ SET (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD" )
76
75
SET (IPHLPAPI_LIBRARY iphlpapi.lib )
77
76
IF (MSVC AND (CMAKE_CXX_COMPILER_ID MATCHES Clang ))
78
77
# Connect does not work with clang-cl
@@ -118,7 +117,6 @@ IF(CONNECT_WITH_LIBXML2)
118
117
FIND_PACKAGE (LibXml2 )
119
118
IF (LIBXML2_FOUND )
120
119
INCLUDE_DIRECTORIES (${LIBXML2_INCLUDE_DIR} )
121
- SET (ZLIB_LIBRARY "z" ) # see ZLIB_INCLUDE_DIR below
122
120
SET (XML_LIBRARY ${LIBXML2_LIBRARIES} )
123
121
SET (CONNECT_SOURCES ${CONNECT_SOURCES} libdoc.cpp libdoc.h )
124
122
add_definitions (-DLIBXML2_SUPPORT )
@@ -173,8 +171,7 @@ IF(CONNECT_WITH_ODBC)
173
171
# the library 'libiodbc' gets compiled with 'sql'h.
174
172
# This will also need changes in the sources (e.g. #include <isql.h>).
175
173
176
- find_file (ODBC_INCLUDES sql.h
177
- PATHS
174
+ find_path (ODBC_INCLUDE_DIR sql.h
178
175
/usr/include
179
176
/usr/include/odbc
180
177
/usr/local/include
@@ -184,7 +181,7 @@ IF(CONNECT_WITH_ODBC)
184
181
#"C:/Program Files/Microsoft SDKs/Windows/v7.0A/include"
185
182
#"C:/Program Files/Microsoft SDKs/Windows/v6.0a/include"
186
183
#"C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/include"
187
- DOC "Specify the path to sql.h."
184
+ DOC "Specify the directory containing sql.h."
188
185
)
189
186
190
187
find_library (ODBC_LIBRARY
@@ -203,10 +200,9 @@ IF(CONNECT_WITH_ODBC)
203
200
DOC "Specify the ODBC driver manager library here."
204
201
)
205
202
206
- mark_as_advanced (ODBC_LIBRARY ODBC_INCLUDES )
203
+ mark_as_advanced (ODBC_LIBRARY ODBC_INCLUDE_DIR )
207
204
208
- IF (ODBC_INCLUDES AND ODBC_LIBRARY )
209
- get_filename_component (ODBC_INCLUDE_DIR "${ODBC_INCLUDES} " PATH )
205
+ IF (ODBC_INCLUDE_DIR AND ODBC_LIBRARY )
210
206
set (CMAKE_REQUIRED_LIBRARIES ${ODBC_LIBRARY} )
211
207
set (CMAKE_REQUIRED_INCLUDES ${ODBC_INCLUDE_DIR} )
212
208
CHECK_CXX_SOURCE_COMPILES (
@@ -316,19 +312,25 @@ ENDIF(CONNECT_WITH_MONGO)
316
312
# REST
317
313
#
318
314
319
- # OPTION(CONNECT_WITH_REST "Compile CONNECT storage engine with REST support" ON)
315
+ OPTION (CONNECT_WITH_REST "Compile CONNECT storage engine with REST support" ON )
320
316
321
317
IF (CONNECT_WITH_REST )
322
318
MESSAGE (STATUS "=====> REST support is ON" )
323
319
FIND_PACKAGE (cpprestsdk )
324
320
IF (cpprestsdk_FOUND )
325
321
MESSAGE (STATUS "=====> cpprestsdk found" )
322
+ IF (UNIX )
323
+ # INCLUDE_DIRECTORIES(${CPPRESTSDK_INCLUDE_DIR})
324
+ # If needed edit next line to set the path to libcpprest.so
325
+ SET (REST_LIBRARY -lcpprest )
326
+ MESSAGE (STATUS ${REST_LIBRARY} )
327
+ ENDIF (UNIX )
326
328
SET (CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp restget.cpp tabrest.h )
327
329
add_definitions (-DREST_SUPPORT )
328
330
ELSE (NOT cpprestsdk_FOUND )
329
331
MESSAGE (STATUS "=====> cpprestsdk package not found" )
330
332
ENDIF (cpprestsdk_FOUND )
331
- ENDIF (CONNECT_WITH_ZIP )
333
+ ENDIF (CONNECT_WITH_REST )
332
334
333
335
#
334
336
# XMAP
@@ -349,41 +351,32 @@ MYSQL_ADD_PLUGIN(connect ${CONNECT_SOURCES}
349
351
COMPONENT connect-engine
350
352
RECOMPILE_FOR_EMBEDDED
351
353
LINK_LIBRARIES ${ZLIB_LIBRARY} ${XML_LIBRARY} ${ICONV_LIBRARY}
352
- ${ODBC_LIBRARY} ${JDBC_LIBRARY} ${MONGOC_LIBRARY} ${IPHLPAPI_LIBRARY} )
354
+ ${ODBC_LIBRARY} ${JDBC_LIBRARY} ${MONGOC_LIBRARY} ${IPHLPAPI_LIBRARY} ${REST_LIBRARY} )
353
355
354
356
IF (NOT TARGET connect )
355
357
RETURN ()
356
358
ENDIF ()
357
359
358
- # Don't link with bundled zlib and systel libxml2 at the same time.
359
- # System libxml2 uses system zlib, might conflict with the bundled one.
360
- IF (XML_LIBRARY AND BUILD_BUNDLED_ZLIB )
361
- GET_PROPERTY (INCS TARGET connect PROPERTY INCLUDE_DIRECTORIES )
362
- LIST (REMOVE_ITEM INCS ${ZLIB_INCLUDE_DIR} )
363
- SET_PROPERTY (TARGET connect PROPERTY INCLUDE_DIRECTORIES ${INCS} )
364
- ENDIF ()
365
-
366
360
IF (WIN32 )
367
361
IF (libmongoc-1.0_FOUND )
368
- SET_TARGET_PROPERTIES (connect PROPERTIES LINK_FLAGS
369
- "/DELAYLOAD:libbson-1.0.dll /DELAYLOAD:libmongoc-1.0.dll" )
362
+ SET_TARGET_PROPERTIES (connect PROPERTIES LINK_FLAGS
363
+ "/DELAYLOAD:libbson-1.0.dll /DELAYLOAD:libmongoc-1.0.dll" )
370
364
ENDIF (libmongoc-1.0_FOUND )
365
+ ENDIF (WIN32 )
371
366
372
367
# Install some extra files that belong to connect engine
373
-
374
- INSTALL (FILES "$<TARGET_FILE_DIR:connect>/ha_connect.lib"
368
+ IF (WIN32 )
369
+ # install ha_connect.lib
370
+ GET_TARGET_PROPERTY (CONNECT_LOCATION connect LOCATION )
371
+ STRING (REPLACE "dll" "lib" CONNECT_LIB ${CONNECT_LOCATION} )
372
+ IF (CMAKE_CONFIGURATION_TYPES )
373
+ STRING (REPLACE "${CMAKE_CFG_INTDIR} " "\$ {CMAKE_INSTALL_CONFIG_NAME}"
374
+ CONNECT_LIB ${CONNECT_LIB} )
375
+ ENDIF ()
376
+ INSTALL (FILES ${CONNECT_LIB}
375
377
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine )
376
378
ENDIF (WIN32 )
377
379
378
- IF (MSVC )
379
- # Temporarily disable "conversion from size_t .."
380
- IF (CMAKE_SIZEOF_VOID_P EQUAL 8 )
381
- SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267" )
382
- ENDIF ()
383
- SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996" )
384
- string (REPLACE "/permissive-" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} " )
385
- ENDIF ()
386
-
387
380
IF (CONNECT_WITH_JDBC AND JAVA_FOUND AND JNI_FOUND )
388
381
# TODO: Find how to compile and install the java wrapper classes
389
382
# Find required libraries and include directories
@@ -394,3 +387,4 @@ IF(CONNECT_WITH_JDBC AND JAVA_FOUND AND JNI_FOUND)
394
387
${CMAKE_CURRENT_BINARY_DIR} /JdbcInterface.jar
395
388
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine )
396
389
ENDIF ()
390
+
0 commit comments