Skip to content

Commit b7c06da

Browse files
committed
driver/CMakeLists.txt
- Added work-around for a bug in CMake where the STATIC_LIBRARY_FLAGS target property is ignored when creating AR archives of C++ objects on Solaris
1 parent 50d3124 commit b7c06da

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

driver/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,21 @@ TARGET_LINK_LIBRARIES(mysqlcppconn-static ${MY_TARGET_LINK_LIBRARIES_STATIC}
264264
${MYSQLCPPCONN_EXTRA_LIBRARIES}
265265
${MYSQLCPPCONN_ICU_LIBRARY})
266266

267+
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
268+
# We pass objects from our C client library in the
269+
# STATIC_LIBRARY_FLAGS property to create a
270+
# "libmysqlcppconn-static.a" with both the C client library and
271+
# Connector/C++ objects.
272+
#
273+
# In CMake 2.8.5 "SunPro-CXX.cmake" will define the creation of AR
274+
# archives to use "CC -xar ..." but leave out LINK_FLAGS where
275+
# the objects passed to STATIC_LIBRARY_FLAGS will end up. So no
276+
# C client library objects will be in the resulting library.
277+
#
278+
# We set it the archive creation line to the default "ar cr ..."
279+
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
280+
ENDIF()
281+
267282
SET_TARGET_PROPERTIES(mysqlcppconn-static PROPERTIES
268283
LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
269284
COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}"

0 commit comments

Comments
 (0)