Skip to content

Commit 24d8ca6

Browse files
committed
Creating option USE_SERVER_CXXFLAGS when need to build connector using
MYSQL_CFLAGS. Put all options on MYSQLCPPCONN_COMPILE_FLAGS_ENV (Fixed).
1 parent 90f33c5 commit 24d8ca6

File tree

8 files changed

+232
-222
lines changed

8 files changed

+232
-222
lines changed

CMakeLists.txt

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
# conditions of the GPLv2 as it is applied to this software, see the
88
# FLOSS License Exception
99
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
10-
#
10+
#
1111
# This program is free software; you can redistribute it and/or modify
1212
# it under the terms of the GNU General Public License as published
1313
# by the Free Software Foundation; version 2 of the License.
14-
#
14+
#
1515
# This program is distributed in the hope that it will be useful, but
1616
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1717
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1818
# for more details.
19-
#
19+
#
2020
# You should have received a copy of the GNU General Public License along
2121
# with this program; if not, write to the Free Software Foundation, Inc.,
2222
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -80,11 +80,6 @@ IF(CMAKE_ENABLE_C++11)
8080
ENDIF(COMPILER_SUPPORTS_CXX11)
8181
ENDIF(CMAKE_ENABLE_C++11)
8282

83-
SET(MYSQLCPPCONN_COMPILE_FLAGS_ENV "$ENV{CPPFLAGS} ${MYSQL_CXXFLAGS} $ENV{CXXFLAGS}")
84-
MESSAGE(STATUS "Environment compile flags: ${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
85-
86-
SET(MYSQLCPPCONN_LINK_FLAGS_ENV "$ENV{LDFLAGS}")
87-
MESSAGE(STATUS "Environment link flags: ${MYSQLCPPCONN_LINK_FLAGS_ENV}")
8883

8984
#-----------------
9085
# ICU
@@ -233,6 +228,21 @@ IF(MYSQLCLIENT_STATIC_BINDING AND EXISTS "${CMAKE_SOURCE_DIR}/cmake/mysql_versio
233228
ENDIF(LIBMYSQL_CPP_VERSION_ID)
234229
ENDIF()
235230

231+
232+
OPTION(USE_SERVER_CXXFLAGS "USE MYSQL_CXXFLAGS on connector build" 0)
233+
234+
message(STATUS "USE_SERVER_FLAGS : ${USE_SERVER_CXXFLAGS}")
235+
if (USE_SERVER_CXXFLAGS)
236+
SET(MYSQLCPPCONN_COMPILE_FLAGS_ENV "$ENV{CPPFLAGS} ${MYSQL_CXXFLAGS} $ENV{CXXFLAGS}")
237+
else (USE_SERVER_CXXFLAGS)
238+
SET(MYSQLCPPCONN_COMPILE_FLAGS_ENV "$ENV{CPPFLAGS} $ENV{CXXFLAGS}")
239+
endif(USE_SERVER_CXXFLAGS)
240+
241+
MESSAGE(STATUS "Environment compile flags: ${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
242+
243+
SET(MYSQLCPPCONN_LINK_FLAGS_ENV "$ENV{LDFLAGS}")
244+
MESSAGE(STATUS "Environment link flags: ${MYSQLCPPCONN_LINK_FLAGS_ENV}")
245+
236246
# Configuring header file with DM version info
237247
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cppconn/version_info.h.cmake
238248
${CMAKE_BINARY_DIR}/cppconn/version_info.h @ONLY)
@@ -306,12 +316,12 @@ IF(RPM_LAYOUT)
306316
ENDIF()
307317

308318
INSTALL(FILES
309-
${CPACK_RESOURCE_FILE_README}
310-
${CPACK_RESOURCE_FILE_INSTALL}
311-
${CPACK_RESOURCE_FILE_LICENSE}
312-
"${CMAKE_SOURCE_DIR}/Licenses_for_Third-Party_Components.txt"
313-
"${CMAKE_SOURCE_DIR}/ANNOUNCEMENT"
314-
DESTINATION ${DOC_DESTINATION} OPTIONAL)
319+
${CPACK_RESOURCE_FILE_README}
320+
${CPACK_RESOURCE_FILE_INSTALL}
321+
${CPACK_RESOURCE_FILE_LICENSE}
322+
"${CMAKE_SOURCE_DIR}/Licenses_for_Third-Party_Components.txt"
323+
"${CMAKE_SOURCE_DIR}/ANNOUNCEMENT"
324+
DESTINATION ${DOC_DESTINATION} OPTIONAL)
315325

316326
SET(COMMON_IGNORE_FILES
317327
"/CMakeFiles/"
@@ -325,25 +335,25 @@ SET(COMMON_IGNORE_FILES
325335
".directory$"
326336
"CMakeCache.txt"
327337
"Makefile"
328-
"install_manifest.txt"
338+
"install_manifest.txt"
329339
)
330340
SET(PRJ_COMMON_IGNORE_FILES
331341
${COMMON_IGNORE_FILES}
332-
"ANNOUNCEMENT_102_ALPHA"
333-
"ANNOUNCEMENT_103_ALPHA"
334-
"ANNOUNCEMENT_104_BETA"
335-
"ANNOUNCEMENT_105_GA"
336-
"ANNOUNCEMENT_110_GA"
337-
"ANNOUNCEMENT_111_GA"
338-
"ANNOUNCEMENT_DRAFT"
342+
"ANNOUNCEMENT_102_ALPHA"
343+
"ANNOUNCEMENT_103_ALPHA"
344+
"ANNOUNCEMENT_104_BETA"
345+
"ANNOUNCEMENT_105_GA"
346+
"ANNOUNCEMENT_110_GA"
347+
"ANNOUNCEMENT_111_GA"
348+
"ANNOUNCEMENT_DRAFT"
339349
)
340350

341351
SET(CPACK_SOURCE_IGNORE_FILES
342-
${PRJ_COMMON_IGNORE_FILES}
343-
"cppconn/config.h$"
344-
"cppconn/version_info.h$"
345-
"driver/nativeapi/binding_config.h$"
346-
"driver/version_info.h$"
352+
${PRJ_COMMON_IGNORE_FILES}
353+
"cppconn/config.h$"
354+
"cppconn/version_info.h$"
355+
"driver/nativeapi/binding_config.h$"
356+
"driver/version_info.h$"
347357
)
348358
SET(CPACK_PACKAGE_IGNORE_FILES ${PRJ_COMMON_IGNORE_FILES} "something_there" )
349359
SET(CPACK_SOURCE_GENERATOR "TGZ")

driver/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
# conditions of the GPLv2 as it is applied to this software, see the
88
# FLOSS License Exception
99
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
10-
#
10+
#
1111
# This program is free software; you can redistribute it and/or modify
1212
# it under the terms of the GNU General Public License as published
1313
# by the Free Software Foundation; version 2 of the License.
14-
#
14+
#
1515
# This program is distributed in the hope that it will be useful, but
1616
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1717
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1818
# for more details.
19-
#
19+
#
2020
# You should have received a copy of the GNU General Public License along
2121
# with this program; if not, write to the Free Software Foundation, Inc.,
2222
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -281,7 +281,7 @@ ENDIF()
281281

282282
SET_TARGET_PROPERTIES(mysqlcppconn-static PROPERTIES
283283
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
284-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}"
284+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}"
285285
COMPILE_DEFINITIONS CPPCONN_LIB_BUILD=""
286286
STATIC_LIBRARY_FLAGS "${MYSQL_LIB_OBJECTS}")
287287

@@ -290,7 +290,7 @@ SET_TARGET_PROPERTIES(mysqlcppconn
290290
SOVERSION "${MYSQLCPPCONN_SOVERSION}"
291291
VERSION "${MYSQLCPPCONN_SOVERSION}.${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}"
292292
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
293-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}"
293+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}"
294294
COMPILE_DEFINITIONS CPPCONN_SO_BUILD=""
295295
LINK_INTERFACE_LIBRARIES "")
296296

examples/CMakeLists.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
# conditions of the GPLv2 as it is applied to this software, see the
88
# FLOSS License Exception
99
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
10-
#
10+
#
1111
# This program is free software; you can redistribute it and/or modify
1212
# it under the terms of the GNU General Public License as published
1313
# by the Free Software Foundation; version 2 of the License.
14-
#
14+
#
1515
# This program is distributed in the hope that it will be useful, but
1616
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1717
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1818
# for more details.
19-
#
19+
#
2020
# You should have received a copy of the GNU General Public License along
2121
# with this program; if not, write to the Free Software Foundation, Inc.,
2222
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -115,87 +115,87 @@ IF(MYSQLCPPCONN_BUILD_EXAMPLES)
115115
ADD_EXECUTABLE(connect connect.cpp)
116116
SET_TARGET_PROPERTIES(connect PROPERTIES
117117
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
118-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
118+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
119119
TARGET_LINK_LIBRARIES(connect ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES}
120120
${MYSQLCPPCONN_BOOST_SYSTEM_LIBS}
121121
${MYSQLCPPCONN_BOOST_THREAD_LIBS} ${MYSQLCPPCONN_ICU_LIBRARY})
122122

123123
ADD_EXECUTABLE(connection_meta_schemaobj connection_meta_schemaobj.cpp)
124124
SET_TARGET_PROPERTIES(connection_meta_schemaobj PROPERTIES
125125
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
126-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
126+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
127127
TARGET_LINK_LIBRARIES(connection_meta_schemaobj ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES}
128128
${MYSQLCPPCONN_BOOST_SYSTEM_LIBS}
129129
${MYSQLCPPCONN_BOOST_THREAD_LIBS} ${MYSQLCPPCONN_ICU_LIBRARY})
130130

131131
ADD_EXECUTABLE(debug_output debug_output.cpp)
132132
SET_TARGET_PROPERTIES(debug_output PROPERTIES
133133
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
134-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
134+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
135135
TARGET_LINK_LIBRARIES(debug_output ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES}
136136
${MYSQLCPPCONN_BOOST_SYSTEM_LIBS}
137137
${MYSQLCPPCONN_BOOST_THREAD_LIBS} ${MYSQLCPPCONN_ICU_LIBRARY})
138138

139139
ADD_EXECUTABLE(exceptions exceptions.cpp)
140140
SET_TARGET_PROPERTIES(exceptions PROPERTIES
141141
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
142-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
142+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
143143
TARGET_LINK_LIBRARIES(exceptions ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES}
144144
${MYSQLCPPCONN_BOOST_SYSTEM_LIBS}
145145
${MYSQLCPPCONN_BOOST_THREAD_LIBS} ${MYSQLCPPCONN_ICU_LIBRARY})
146146

147147
ADD_EXECUTABLE(prepared_statement prepared_statement.cpp)
148148
SET_TARGET_PROPERTIES(prepared_statement PROPERTIES
149149
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
150-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
150+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
151151
TARGET_LINK_LIBRARIES(prepared_statement ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES}
152152
${MYSQLCPPCONN_BOOST_SYSTEM_LIBS}
153153
${MYSQLCPPCONN_BOOST_THREAD_LIBS} ${MYSQLCPPCONN_ICU_LIBRARY})
154154

155155
ADD_EXECUTABLE(resultset resultset.cpp)
156156
SET_TARGET_PROPERTIES(resultset PROPERTIES
157157
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
158-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
158+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
159159
TARGET_LINK_LIBRARIES(resultset ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES}
160160
${MYSQLCPPCONN_BOOST_SYSTEM_LIBS}
161161
${MYSQLCPPCONN_BOOST_THREAD_LIBS} ${MYSQLCPPCONN_ICU_LIBRARY})
162162

163163
ADD_EXECUTABLE(resultset_binary resultset_binary.cpp)
164164
SET_TARGET_PROPERTIES(resultset_binary PROPERTIES
165165
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
166-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
166+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
167167
TARGET_LINK_LIBRARIES(resultset_binary ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES}
168168
${MYSQLCPPCONN_BOOST_SYSTEM_LIBS}
169169
${MYSQLCPPCONN_BOOST_THREAD_LIBS} ${MYSQLCPPCONN_ICU_LIBRARY})
170170

171171
ADD_EXECUTABLE(resultset_meta resultset_meta.cpp)
172172
SET_TARGET_PROPERTIES(resultset_meta PROPERTIES
173173
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
174-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
174+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
175175
TARGET_LINK_LIBRARIES(resultset_meta ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES}
176176
${MYSQLCPPCONN_BOOST_SYSTEM_LIBS}
177177
${MYSQLCPPCONN_BOOST_THREAD_LIBS} ${MYSQLCPPCONN_ICU_LIBRARY})
178178

179179
ADD_EXECUTABLE(resultset_types resultset_types.cpp)
180180
SET_TARGET_PROPERTIES(resultset_types PROPERTIES
181181
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
182-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
182+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
183183
TARGET_LINK_LIBRARIES(resultset_types ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES}
184184
${MYSQLCPPCONN_BOOST_SYSTEM_LIBS}
185185
${MYSQLCPPCONN_BOOST_THREAD_LIBS} ${MYSQLCPPCONN_ICU_LIBRARY})
186186

187187
ADD_EXECUTABLE(statement statement.cpp)
188188
SET_TARGET_PROPERTIES(statement PROPERTIES
189189
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
190-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
190+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
191191
TARGET_LINK_LIBRARIES(statement ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES}
192192
${MYSQLCPPCONN_BOOST_SYSTEM_LIBS}
193193
${MYSQLCPPCONN_BOOST_THREAD_LIBS} ${MYSQLCPPCONN_ICU_LIBRARY})
194194

195195
ADD_EXECUTABLE(dynamic_load dynamic_load.cpp)
196196
SET_TARGET_PROPERTIES(dynamic_load PROPERTIES
197197
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
198-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
198+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
199199
TARGET_LINK_LIBRARIES(dynamic_load ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES}
200200
${MYSQLCPPCONN_BOOST_SYSTEM_LIBS}
201201
${MYSQLCPPCONN_BOOST_THREAD_LIBS} ${MYSQLCPPCONN_ICU_LIBRARY})

test/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
# conditions of the GPLv2 as it is applied to this software, see the
88
# FLOSS License Exception
99
# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
10-
#
10+
#
1111
# This program is free software; you can redistribute it and/or modify
1212
# it under the terms of the GNU General Public License as published
1313
# by the Free Software Foundation; version 2 of the License.
14-
#
14+
#
1515
# This program is distributed in the hope that it will be useful, but
1616
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1717
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1818
# for more details.
19-
#
19+
#
2020
# You should have received a copy of the GNU General Public License along
2121
# with this program; if not, write to the Free Software Foundation, Inc.,
2222
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -45,7 +45,7 @@ ADD_EXECUTABLE(static_test static_test.cpp)
4545

4646
SET_TARGET_PROPERTIES(static_test PROPERTIES
4747
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
48-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
48+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
4949

5050
TARGET_LINK_LIBRARIES(static_test ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES})
5151

@@ -54,8 +54,8 @@ LINK_DIRECTORIES(${GLIB_DIR}/lib)
5454
ADD_EXECUTABLE(driver_test driver_test.cpp)
5555

5656
SET_TARGET_PROPERTIES(driver_test PROPERTIES
57-
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
58-
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
57+
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
58+
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV}")
5959

6060
TARGET_LINK_LIBRARIES(driver_test ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES})
6161

0 commit comments

Comments
 (0)