Commit 19f0d6b2 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Small CMake fixes :

- add version info for the client library, dynamic plugins and some utilities
- do not recompile client library sources 3 times (for mysqlclient , mysqlclient_notls and libmysql)
  One time is sufficient, so get rid of mysqlclient_notls, and link  static client library  to  the shared.
- remove incremental linking flag
parent 2982738e
...@@ -171,15 +171,7 @@ IF(MSVC) ...@@ -171,15 +171,7 @@ IF(MSVC)
IF(CMAKE_SIZEOF_VOID_P MATCHES 4) IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 4) ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 4)
SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL:NO")
# Disable automatic manifest generation.
STRING(REPLACE "/MANIFEST" "/MANIFEST:NO" CMAKE_EXE_LINKER_FLAGS
${CMAKE_EXE_LINKER_FLAGS})
# Explicitly disable it since it is the default for newer versions of VS
STRING(REGEX MATCH "MANIFEST:NO" tmp_manifest ${CMAKE_EXE_LINKER_FLAGS})
IF(NOT tmp_manifest)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
ENDIF(NOT tmp_manifest)
ENDIF(MSVC) ENDIF(MSVC)
IF(WIN32) IF(WIN32)
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake") INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake")
# We use the "mysqlclient_notls" library here just as safety, in case # We use the "mysqlclient" library here just as safety, in case
# any of the clients here would go beyond the client API and access the # any of the clients here would go beyond the client API and access the
# Thread Local Storage directly. # Thread Local Storage directly.
...@@ -29,27 +29,27 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ...@@ -29,27 +29,27 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}) ${CMAKE_CURRENT_BINARY_DIR})
MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c DESTINATION bin) MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc ../mysys/my_conio.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysql mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysql mysqlclient wsock32)
MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc DESTINATION bin) MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc DESTINATION bin)
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS") SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys regex wsock32 dbug) TARGET_LINK_LIBRARIES(mysqltest mysqlclient mysys regex wsock32 dbug)
MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c DESTINATION bin) MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient wsock32)
MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c ../mysys/mf_getdate.c DESTINATION bin) MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c ../mysys/mf_getdate.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqldump mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqldump mysqlclient wsock32)
MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c DESTINATION bin) MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqlimport mysqlclient wsock32)
MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c DESTINATION bin) MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient wsock32)
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs) ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c DESTINATION bin) MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqlshow mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqlshow mysqlclient wsock32)
MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc
../mysys/mf_tempdir.c ../mysys/mf_tempdir.c
...@@ -59,10 +59,10 @@ MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc ...@@ -59,10 +59,10 @@ MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc
../mysys/my_vle.c ../mysys/my_vle.c
../mysys/base64.c ../mysys/base64.c
DESTINATION bin) DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient wsock32)
MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc DESTINATION bin) MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc DESTINATION bin)
TARGET_LINK_LIBRARIES(mysqladmin mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysqladmin mysqlclient wsock32)
MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c DESTINATION bin) MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c DESTINATION bin)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS") SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
......
...@@ -32,26 +32,26 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp ...@@ -32,26 +32,26 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp
--charset=${PROJECT_SOURCE_DIR}/sql/share/charsets --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets
--out-dir=${CMAKE_BINARY_DIR}/sql/share/ --out-dir=${CMAKE_BINARY_DIR}/sql/share/
--header_file=${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp --header_file=${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp
--name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h --name_file=${CMAKE_BINARY_DIR}/include/mysqld_ername.h.tmp
--state_file=${CMAKE_BINARY_DIR}/include/sql_state.h --state_file=${CMAKE_BINARY_DIR}/include/sql_state.h.tmp
--in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp ${CMAKE_BINARY_DIR}/include/mysqld_error.h COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp ${CMAKE_BINARY_DIR}/include/mysqld_error.h
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/mysqld_ername.h.tmp ${CMAKE_BINARY_DIR}/include/mysqld_ername.h
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/include/sql_state.h.tmp ${CMAKE_BINARY_DIR}/include/sql_state.h
DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt) DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt)
ADD_CUSTOM_TARGET(GenError ADD_CUSTOM_TARGET(GenError
ALL ALL
DEPENDS ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp) DEPENDS ${CMAKE_BINARY_DIR}/include/mysqld_error.h.tmp)
ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c)
TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock32) TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock32)
ADD_EXECUTABLE(perror perror.c) MYSQL_ADD_EXECUTABLE(perror perror.c)
TARGET_LINK_LIBRARIES(perror strings mysys debug dbug wsock32) TARGET_LINK_LIBRARIES(perror strings mysys debug dbug wsock32)
ADD_EXECUTABLE(resolveip resolveip.c) MYSQL_ADD_EXECUTABLE(resolveip resolveip.c)
TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug wsock32) TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug wsock32)
ADD_EXECUTABLE(replace replace.c) MYSQL_ADD_EXECUTABLE(replace replace.c COMPONENT Server)
TARGET_LINK_LIBRARIES(replace strings mysys debug dbug wsock32) TARGET_LINK_LIBRARIES(replace strings mysys debug dbug wsock32)
MYSQL_INSTALL_TARGETS(comp_err my_print_defaults perror resolveip replace DESTINATION bin COMPONENT Server)
...@@ -110,18 +110,16 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c ...@@ -110,18 +110,16 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
ADD_LIBRARY(mysqlclient STATIC ${CLIENT_SOURCES}) ADD_LIBRARY(mysqlclient STATIC ${CLIENT_SOURCES})
ADD_DEPENDENCIES(mysqlclient GenError) ADD_DEPENDENCIES(mysqlclient GenError)
TARGET_LINK_LIBRARIES(mysqlclient)
ADD_LIBRARY(mysqlclient_notls STATIC ${CLIENT_SOURCES}) SET(SHARED_SOURCES dll.c libmysql.def)
ADD_DEPENDENCIES(mysqlclient_notls GenError) ADD_VERSION_INFO(libmysql SHARED SHARED_SOURCES)
TARGET_LINK_LIBRARIES(mysqlclient_notls) ADD_LIBRARY(libmysql SHARED ${SHARED_SOURCES})
ADD_LIBRARY(libmysql SHARED ${CLIENT_SOURCES} dll.c libmysql.def)
IF(WIN32) IF(WIN32)
SET_TARGET_PROPERTIES(libmysql mysqlclient PROPERTIES COMPILE_FLAGS "-DUSE_TLS") SET_TARGET_PROPERTIES(libmysql mysqlclient PROPERTIES COMPILE_FLAGS "-DUSE_TLS")
ENDIF(WIN32) ENDIF(WIN32)
ADD_DEPENDENCIES(libmysql GenError) ADD_DEPENDENCIES(libmysql GenError)
TARGET_LINK_LIBRARIES(libmysql wsock32) TARGET_LINK_LIBRARIES(libmysql mysqlclient ws2_32)
ADD_DEFINITIONS(-DHAVE_DLOPEN) ADD_DEFINITIONS(-DHAVE_DLOPEN)
MYSQL_INSTALL_TARGETS(mysqlclient DESTINATION lib COMPONENT Development) MYSQL_INSTALL_TARGETS(mysqlclient DESTINATION lib COMPONENT Development)
......
...@@ -36,6 +36,7 @@ IF(NOT SOURCE_SUBLIBS) ...@@ -36,6 +36,7 @@ IF(NOT SOURCE_SUBLIBS)
#Create a DLL.The name of the dll is ha_<storage_engine>.dll #Create a DLL.The name of the dll is ha_<storage_engine>.dll
#The dll is linked to the mysqld executable #The dll is linked to the mysqld executable
SET(dyn_libname ha_${libname}) SET(dyn_libname ha_${libname})
ADD_VERSION_INFO(${dyn_libname} SHARED ${engine}_SOURCES)
ADD_LIBRARY(${dyn_libname} MODULE ${${engine}_SOURCES}) ADD_LIBRARY(${dyn_libname} MODULE ${${engine}_SOURCES})
TARGET_LINK_LIBRARIES (${dyn_libname} mysqlservices mysqld) TARGET_LINK_LIBRARIES (${dyn_libname} mysqlservices mysqld)
IF(${engine}_LIBS) IF(${engine}_LIBS)
......
...@@ -20,9 +20,9 @@ ADD_DEFINITIONS("-DMYSQL_CLIENT") ...@@ -20,9 +20,9 @@ ADD_DEFINITIONS("-DMYSQL_CLIENT")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_EXECUTABLE(mysql_client_test mysql_client_test.c ../mysys/my_memmem.c) ADD_EXECUTABLE(mysql_client_test mysql_client_test.c ../mysys/my_memmem.c)
TARGET_LINK_LIBRARIES(mysql_client_test mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(mysql_client_test mysqlclient wsock32)
ADD_EXECUTABLE(bug25714 bug25714.c) ADD_EXECUTABLE(bug25714 bug25714.c)
TARGET_LINK_LIBRARIES(bug25714 mysqlclient_notls wsock32) TARGET_LINK_LIBRARIES(bug25714 mysqlclient wsock32)
INSTALL(TARGETS mysql_client_test DESTINATION bin COMPONENT Test) INSTALL(TARGETS mysql_client_test DESTINATION bin COMPONENT Test)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment