Skip to content

Commit df117a0

Browse files
committed
Single header jdbc.h support
1 parent eac6a1a commit df117a0

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,11 @@ file(WRITE "${INFO}" "Connector/C++ build information.\n\n")
236236
set(INFO_PREFIX "jdbc-")
237237

238238
merge_libraries(connector-jdbc jdbc)
239+
target_link_libraries(connector-jdbc PUBLIC Boost::boost)
239240

240241
if(MAINTAINER_MODE)
241242
merge_libraries(connector-jdbc-static STATIC jdbc)
243+
target_link_libraries(connector-jdbc-static PUBLIC Boost::boost)
242244
endif()
243245

244246

@@ -306,6 +308,13 @@ INSTALL(FILES ${MYSQLCPPCONN_SPECIFIC_INSTALL_HEADERS}
306308
COMPONENT JDBCDev
307309
)
308310

311+
# Note: Copy to build location so that test code can use headers without
312+
# installing them first.
313+
314+
file(COPY ${MYSQLCPPCONN_SPECIFIC_INSTALL_HEADERS}
315+
DESTINATION "${CMAKE_BINARY_DIR}/include/jdbc"
316+
)
317+
309318
if(TARGET connector-jdbc-static)
310319

311320
set_property(TARGET connector-jdbc-static PROPERTY OUTPUT_NAME ${LIB_NAME_STATIC})

cppconn/CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ CONFIGURE_FILE(version_info.h.cmake version_info.h @ONLY)
6565

6666
SET(MYSQLCPPCONN_INSTALL_HEADERS
6767
build_config.h
68-
${CMAKE_CURRENT_BINARY_DIR}/config.h
68+
"${CMAKE_CURRENT_BINARY_DIR}/config.h"
6969
connection.h
7070
datatype.h
7171
driver.h
@@ -78,11 +78,18 @@ SET(MYSQLCPPCONN_INSTALL_HEADERS
7878
statement.h
7979
sqlstring.h
8080
warning.h
81-
${CMAKE_CURRENT_BINARY_DIR}/version_info.h
81+
"${CMAKE_CURRENT_BINARY_DIR}/version_info.h"
8282
variant.h)
8383

8484
INSTALL(
8585
FILES ${MYSQLCPPCONN_INSTALL_HEADERS}
86-
DESTINATION ${INSTALL_INCLUDE_DIR}/cppconn
86+
DESTINATION "${INSTALL_INCLUDE_DIR}/cppconn"
8787
COMPONENT JDBCDev
8888
)
89+
90+
# Note: Copy to build location so that test code can use headers without
91+
# installing them first.
92+
93+
file(COPY ${MYSQLCPPCONN_INSTALL_HEADERS}
94+
DESTINATION "${CMAKE_BINARY_DIR}/include/jdbc/cppconn"
95+
)

link_test/jdbc_test.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@
4848

4949
#include <boost/scoped_ptr.hpp>
5050

51-
#include <jdbc/mysql_connection.h>
52-
#include <jdbc/mysql_driver.h>
53-
#include <jdbc/cppconn/resultset.h>
54-
#include <jdbc/cppconn/statement.h>
51+
#include <mysql/jdbc.h>
5552

5653
#define DEFAULT_URI "tcp://127.0.0.1"
5754
#define EXAMPLE_USER "root"

0 commit comments

Comments
 (0)