-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,13 +10,13 @@ | |
# This program is also distributed with certain software (including | ||
# but not limited to OpenSSL) that is licensed under separate terms, | ||
# as designated in a particular file or component or in included license | ||
# documentation. The authors of MySQL hereby grant you an | ||
# documentation. The authors of MySQL hereby grant you an | ||
# additional permission to link the program and your derivative works | ||
# with the separately licensed software that they have included with | ||
# MySQL. | ||
# | ||
# Without limiting anything contained in the foregoing, this file, | ||
# which is part of MySQL Connector/C++, is also subject to the | ||
# which is part of MySQL Connector/ODBC, is also subject to the | ||
# Universal FOSS Exception, version 1.0, a copy of which can be found at | ||
# http://oss.oracle.com/licenses/universal-foss-exception. | ||
# | ||
|
@@ -27,7 +27,7 @@ | |
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
||
########################################################################## | ||
|
||
|
@@ -118,7 +118,7 @@ set(ENV_OR_OPT_VARS | |
MYSQL_DIR | ||
MYSQL_INCLUDE_DIR | ||
MYSQL_LIB_DIR | ||
MYSQL_LIB_DIR_RUNTIME | ||
MYSQL_LIB_DIR_LIST | ||
MYSQL_CFLAGS | ||
MYSQL_CXXFLAGS | ||
MYSQL_CONFIG_EXECUTABLE | ||
|
@@ -129,12 +129,6 @@ set(ENV_OR_OPT_VARS | |
MYSQL_LINK_FLAGS | ||
) | ||
|
||
IF(NOT WIN32) | ||
set(MYSQL_COMPILER_ID | ||
MYSQL_COMPILER_VERSION | ||
) | ||
ENDIF(NOT WIN32) | ||
|
||
# Mark the variable names that have values that are paths | ||
set(ENV_OR_OPT_PATH_VARS | ||
MYSQL_DIR | ||
|
@@ -356,10 +350,10 @@ macro(_mysql_config _var _regex _opt) | |
_mysql_conf(_mysql_config_output ${_opt}) | ||
string(REGEX MATCHALL "${_regex}([^ ]+)" _mysql_config_output "${_mysql_config_output}") | ||
string(REGEX REPLACE "^[ \t]+" "" _mysql_config_output "${_mysql_config_output}") | ||
string(REGEX REPLACE "${_regex}" "" _mysql_config_output "${_mysql_config_output}") | ||
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") | ||
string(REGEX REPLACE " -latomic" "" _mysql_config_output "${_mysql_config_output}") | ||
ENDIF() | ||
string(REGEX REPLACE "${_regex}" "" _mysql_config_output "${_mysql_config_output}") | ||
separate_arguments(_mysql_config_output) | ||
set(${_var} ${_mysql_config_output}) | ||
endmacro() | ||
|
@@ -384,11 +378,11 @@ macro(_mysql_config_replace _var _regex1 _replace _regex2 _opt) | |
_mysql_conf(_mysql_config_output ${_opt}) | ||
string(REGEX MATCHALL "${_regex2}([^ ]+)" _mysql_config_output "${_mysql_config_output}") | ||
string(REGEX REPLACE "^[ \t]+" "" _mysql_config_output "${_mysql_config_output}") | ||
string(REGEX REPLACE "${_regex2}" "" _mysql_config_output "${_mysql_config_output}") | ||
string(REGEX REPLACE "${_regex1}" "${_replace}" _mysql_config_output "${_mysql_config_output}") | ||
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") | ||
string(REGEX REPLACE " -latomic" "" _mysql_config_output "${_mysql_config_output}") | ||
ENDIF() | ||
string(REGEX REPLACE "${_regex2}" "" _mysql_config_output "${_mysql_config_output}") | ||
string(REGEX REPLACE "${_regex1}" "${_replace}" _mysql_config_output "${_mysql_config_output}") | ||
separate_arguments(_mysql_config_output) | ||
set(${_var} ${_mysql_config_output}) | ||
endmacro() | ||
|
@@ -514,20 +508,9 @@ elseif(MYSQL_CONFIG_EXECUTABLE) | |
"\"${MYSQL_CONFIG_EXECUTABLE}\"") | ||
endif() | ||
|
||
set(_found_mysql_h) | ||
foreach(_incdir ${MYSQL_INCLUDE_DIR}) | ||
if(NOT EXISTS "${_incdir}") | ||
message(FATAL_ERROR "Could not find the directory \"${_incdir}\" " | ||
"from running \"${MYSQL_CONFIG_EXECUTABLE}\"") | ||
endif() | ||
if(EXISTS "${_incdir}/mysql.h") | ||
set(_found_mysql_h 1) | ||
endif() | ||
endforeach() | ||
|
||
if(NOT _found_mysql_h) | ||
if(NOT EXISTS "${MYSQL_INCLUDE_DIR}/mysql.h") | ||
message(FATAL_ERROR "Could not find \"mysql.h\" in \"${MYSQL_INCLUDE_DIR}\" " | ||
"from running \"${MYSQL_CONFIG_EXECUTABLE}\"") | ||
"found from running \"${MYSQL_CONFIG_EXECUTABLE}\"") | ||
endif() | ||
|
||
else() | ||
|
@@ -608,23 +591,31 @@ elseif(MYSQL_CONFIG_EXECUTABLE) | |
# This code assumes there is just one "-L...." and that | ||
# no space between "-L" and the path | ||
_mysql_config(MYSQL_LIB_DIR "(^| )-L" "--libs") | ||
if(NOT MYSQL_LIB_DIR) | ||
message(FATAL_ERROR "Could not find the library dir from running " | ||
"\"${MYSQL_CONFIG_EXECUTABLE}\"") | ||
endif() | ||
|
||
# In case mysql_config returns two paths: (0) runtime and (1) libmysqlclient | ||
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") | ||
# This is needed to make Solaris binaries using the default runtime lib path | ||
_mysql_config(DEV_STUDIO_RUNTIME_DIR "(^| )-R" "--libs") | ||
ENDIF() | ||
|
||
|
||
# In case mysql_config returns several paths: libmysqlclient is last | ||
LIST(LENGTH MYSQL_LIB_DIR n) | ||
IF( ${n} GREATER 1) | ||
LIST(GET MYSQL_LIB_DIR 0 MYSQL_LIB_DIR_RUNTIME) | ||
#copy list of directories | ||
SET(MYSQL_LIB_DIR_LIST ${MYSQL_LIB_DIR}) | ||
|
||
MATH(EXPR ind "${n}-1") | ||
LIST(GET MYSQL_LIB_DIR ${ind} MYSQL_LIB_DIR) | ||
ENDIF() | ||
if(NOT MYSQL_LIB_DIR) | ||
message(FATAL_ERROR "Could not find the library dir from running " | ||
"\"${MYSQL_CONFIG_EXECUTABLE}\"") | ||
endif() | ||
|
||
foreach(_libdir ${MYSQL_LIB_DIR}) | ||
if(NOT EXISTS "${_libdir}") | ||
message(FATAL_ERROR "Could not find the directory \"${_libdir}\" " | ||
"from running \"${MYSQL_CONFIG_EXECUTABLE}\"") | ||
endif() | ||
endforeach() | ||
if(NOT EXISTS "${MYSQL_LIB_DIR}") | ||
message(FATAL_ERROR "Could not find the directory \"${MYSQL_LIB_DIR}\" " | ||
"found from running \"${MYSQL_CONFIG_EXECUTABLE}\"") | ||
endif() | ||
|
||
# We have the assumed MYSQL_LIB_DIR. The output from "mysql_config" | ||
# might not be correct for static libraries, so we might need to | ||
|
@@ -655,9 +646,14 @@ elseif(MYSQL_CONFIG_EXECUTABLE) | |
else() | ||
|
||
_mysql_config(MYSQL_LIBRARIES "(^| )-l" "--libs") | ||
|
||
FOREACH(__lib IN LISTS MYSQL_LIBRARIES) | ||
string(REGEX MATCH "mysqlclient([^ ]*)" _matched_lib __lib) | ||
IF(_matched_lib) | ||
set(_search_libs ${matched_lib}) | ||
ENDIF() | ||
ENDFOREACH() | ||
# First library is assumed to be the client library | ||
list(GET MYSQL_LIBRARIES 0 _search_libs) | ||
# list(GET MYSQL_LIBRARIES 0 _search_libs) | ||
find_library(MYSQL_LIB | ||
NAMES | ||
${_search_libs} | ||
|
@@ -705,6 +701,19 @@ if(MYSQLCLIENT_STATIC_LINKING AND | |
list(APPEND MYSQL_LIBRARIES "rt") | ||
endif() | ||
|
||
# For dynamic linking use the built-in sys and strings | ||
if(NOT MYSQLCLIENT_STATIC_LINKING) | ||
list(APPEND SYS_LIBRARIES "mysql_sys") | ||
list(APPEND SYS_LIBRARIES "mysql_strings") | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
silvakid
Author
Contributor
|
||
list(APPEND SYS_LIBRARIES ${MYSQL_LIBRARIES}) | ||
SET(MYSQL_LIBRARIES ${SYS_LIBRARIES}) | ||
|
||
#if(NOT MYSQLCLIENT_STATIC_LINKING AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||
# list(REVERSE MYSQL_LIBRARIES) | ||
#endif() | ||
|
||
endif() | ||
|
||
if(MYSQL_EXTRA_LIBRARIES) | ||
separate_arguments(MYSQL_EXTRA_LIBRARIES) | ||
list(APPEND MYSQL_LIBRARIES ${MYSQL_EXTRA_LIBRARIES}) | ||
|
@@ -818,24 +827,16 @@ endif() | |
# set(CMAKE_CXX_FLAGS_${CMAKEBT} "${CMAKE_CXX_FLAGS_${CMAKEBT}} ${MYSQL_CXXFLAGS}") | ||
|
||
include_directories("${MYSQL_INCLUDE_DIR}") | ||
link_directories("${MYSQL_LIB_DIR}" "${MYSQL_LIB_DIR_RUNTIME}") | ||
link_directories("${MYSQL_LIB_DIR}") | ||
|
||
IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") | ||
SET(RPATH " ${RPATH} ${MYSQL_LIB_DIR_RUNTIME}") | ||
MESSAGE(STATUS "MYSQL_LIB_DIR_LIST = ${MYSQL_LIB_DIR_LIST}") | ||
IF(MYSQL_LIB_DIR_LIST) | ||
FOREACH(__libpath IN LISTS MYSQL_LIB_DIR_LIST) | ||
link_directories("${__libpath}") | ||
ENDFOREACH() | ||
ENDIF() | ||
|
||
########################################################################## | ||
# | ||
# Get libmysqlclient compiler ID and VERSION | ||
# | ||
########################################################################## | ||
IF(NOT WIN32) | ||
_mysql_conf(MYSQL_COMPILER_VERSION "") | ||
STRING(REGEX MATCH "Compiler:[a-zA-Z0-9\\. ]+" MYSQL_COMPILER_VERSION ${MYSQL_COMPILER_VERSION}) | ||
STRING(REGEX REPLACE "Compiler: " "" MYSQL_COMPILER_VERSION ${MYSQL_COMPILER_VERSION}) | ||
STRING(REGEX MATCH "[a-zA-Z0-9]+" MYSQL_COMPILER_ID ${MYSQL_COMPILER_VERSION}) | ||
STRING(REGEX REPLACE "[a-zA-Z0-9]+ " "" MYSQL_COMPILER_VERSION ${MYSQL_COMPILER_VERSION}) | ||
ENDIF(NOT WIN32) | ||
|
||
|
||
########################################################################## | ||
# | ||
|
@@ -848,7 +849,6 @@ message(STATUS "MySQL client environment/cmake variables set that the user can o | |
message(STATUS " MYSQL_DIR : ${MYSQL_DIR}") | ||
message(STATUS " MYSQL_INCLUDE_DIR : ${MYSQL_INCLUDE_DIR}") | ||
message(STATUS " MYSQL_LIB_DIR : ${MYSQL_LIB_DIR}") | ||
message(STATUS " MYSQL_LIB_DIR_RUNTIME : ${MYSQL_LIB_DIR_RUNTIME}") | ||
message(STATUS " MYSQL_CONFIG_EXECUTABLE : ${MYSQL_CONFIG_EXECUTABLE}") | ||
message(STATUS " MYSQL_CXX_LINKAGE : ${MYSQL_CXX_LINKAGE}") | ||
message(STATUS " MYSQL_CFLAGS : ${MYSQL_CFLAGS}") | ||
|
@@ -867,8 +867,3 @@ message(STATUS " MYSQL_VERSION : ${MYSQL_VERSION}") | |
message(STATUS " MYSQL_VERSION_ID : ${MYSQL_VERSION_ID}") | ||
message(STATUS " MYSQL_LIB : ${MYSQL_LIB}") | ||
message(STATUS " MYSQL_LIBRARIES : ${MYSQL_LIBRARIES}") | ||
|
||
IF(NOT WIN32) | ||
message(STATUS " MYSQL_COMPILER_ID : ${MYSQL_COMPILER_ID}") | ||
message(STATUS " MYSQL_COMPILER_VERSION : ${MYSQL_COMPILER_VERSION}") | ||
ENDIF(NOT WIN32) |
@silvakid Those two lines are breaking my build under Slackware Linux 14.2, so could they've been made Solaris specific?