Commit 2df6b1cb authored by reggie@big_geek's avatar reggie@big_geek

cmake corrections to fix compiling on visual 7.1

parent 67835c13
......@@ -2,12 +2,27 @@ PROJECT(MySql)
EXEC_PROGRAM(cscript.exe win ARGS config-version.js OUT_VARIABLE out)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996 -D_DEBUG")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4996 -D_DEBUG")
# in some places we use DBUG_OFF
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D DBUG_OFF")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D DBUG_OFF")
IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8")
# replace /MDd with /MTd
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT})
STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG_INIT ${CMAKE_C_FLAGS_DEBUG_INIT})
STRING(REPLACE "/MD" "/MT" CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
STRING(REPLACE "/MDd" "/MTd" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
STRING(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
# remove support for Exception handling
STRING(REPLACE "/GX" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT ${CMAKE_CXX_FLAGS_INIT})
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT})
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996 -DDBUG_OFF -DNDEBUG")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4996 -DDBUG_OFF -DNDEBUG")
ADD_DEFINITIONS("-D_WINDOWS -D__WIN__")
SUBDIRS(vio dbug strings regex mysys zlib storage/innobase storage/heap storage/myisam storage/myisammrg
extra extra/yassl extra/yassl/taocrypt client sql)
SUBDIRS(vio dbug strings regex mysys extra zlib storage/innobase storage/heap storage/myisam storage/myisammrg
extra/yassl extra/yassl/taocrypt client sql)
......@@ -3,6 +3,7 @@ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
ADD_DEFINITIONS(-DUSE_TLS -DMYSQL_CLIENT)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_SOURCE_DIR}/extra/yassl/include ${CMAKE_SOURCE_DIR}/libmysql)
ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c
../sql-common/client.c ../strings/ctype-big5.c ../strings/ctype-bin.c
......@@ -38,8 +39,9 @@ ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c
../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c
../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c
${CMAKE_SOURCE_DIR}/include/mysql_version.h)
${PROJECT_SOURCE_DIR}/include/mysql_version.h)
ADD_DEPENDENCIES(mysqlclient comp_err)
ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc)
LINK_DIRECTORIES(${MYSQL_BINARY_DIR}/mysys ${MYSQL_BINARY_DIR}/zlib)
TARGET_LINK_LIBRARIES(mysql mysqlclient mysys yassl zlib dbug yassl taocrypt wsock32)
SET(CMAKE_CXX_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX -D__WIN32__")
SET(CMAKE_C_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -D__WIN32__")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(dbug dbug.c factorial.c sanity.c)
SET(CMAKE_CXX_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
......
SET(CMAKE_CXX_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(myisam ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c ft_stem.c
......
SET(CMAKE_CXX_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
ADD_LIBRARY(myisammrg myrg_close.c myrg_create.c myrg_delete.c myrg_extra.c myrg_info.c
......
SET(CMAKE_C_FLAGS_DEBUG "-D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_RELEASE "-DDBUG_OFF -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "-DDBUG_OFF -DNDEBUG")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX")
ADD_DEFINITIONS(-D_WINDOWS -D__WIN__)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
......
......@@ -7,12 +7,13 @@ SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/message.rc
${CMAKE_SOURCE_DIR}/sql/message.h
${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc
${CMAKE_SOURCE_DIR}/include/mysqld_error.h
${CMAKE_SOURCE_DIR}/include/mysqld_ername.h
${CMAKE_SOURCE_DIR}/include/sql_state.h
${CMAKE_SOURCE_DIR}/include/mysql_version.h
${CMAKE_SOURCE_DIR}/sql/handlerton.cc
${CMAKE_SOURCE_DIR}/sql/lex_hash.h PROPERTIES GENERATED 1)
${CMAKE_SOURCE_DIR}/sql/lex_hash.h
${PROJECT_SOURCE_DIR}/include/mysqld_error.h
${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
${PROJECT_SOURCE_DIR}/include/sql_state.h PROPERTIES GENERATED 1)
ADD_DEFINITIONS(-DWITH_INNOBASE_STORAGE_ENGINE -DHAVE_ARCHIVE_DB -DHAVE_BLACKHOLE_DB -DHAVE_EXAMPLE_DB)
ADD_DEFINITIONS(-DHAVE_ROW_BASED_REPLICATION -DHAVE_FEDERATED_DB -DMYSQL_SERVER -D_CONSOLE -DHAVE_DLOPEN -DWITH_PARTITION_STORAGE_ENGINE -D_CRT_SECURE_NO_DEPRECATE)
......@@ -36,27 +37,27 @@ ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc discover.
sql_update.cc sql_view.cc sql_yacc.h sql_yacc.cc strfunc.cc table.cc thr_malloc.cc time.cc tztime.cc
uniques.cc unireg.cc item_xmlfunc.cc rpl_tblmap.cc sql_binlog.cc event_executor.cc
event_timed.cc sql_tablespace.cc event.cc ../sql-common/my_user.c
${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc
${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
${CMAKE_SOURCE_DIR}/include/mysqld_error.h
${CMAKE_SOURCE_DIR}/include/mysqld_ername.h
${CMAKE_SOURCE_DIR}/include/sql_state.h
${CMAKE_SOURCE_DIR}/include/mysql_version.h
${CMAKE_SOURCE_DIR}/sql/handlerton.cc
${CMAKE_SOURCE_DIR}/sql/lex_hash.h)
${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
${PROJECT_SOURCE_DIR}/include/mysqld_error.h
${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
${PROJECT_SOURCE_DIR}/include/sql_state.h
${PROJECT_SOURCE_DIR}/include/mysql_version.h
${PROJECT_SOURCE_DIR}/sql/handlerton.cc
${PROJECT_SOURCE_DIR}/sql/lex_hash.h)
TARGET_LINK_LIBRARIES(mysqld heap myisam myisammrg innobase mysys yassl zlib dbug yassl taocrypt strings vio regex wsock32)
# Sql Parser custom command
ADD_CUSTOM_COMMAND(
SOURCE ${CMAKE_SOURCE_DIR}/sql/sql_yacc.yy
OUTPUT ${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc
SOURCE ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy
OUTPUT ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
COMMAND bison.exe ARGS --defines=sql_yacc.h --output=sql_yacc.cc sql_yacc.yy
DEPENDS ${CMAKE_SOURCE_DIR}/sql/sql_yacc.yy)
DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
OUTPUT ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h
COMMAND echo
DEPENDS ${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc
DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc
)
# Windows message file
......@@ -67,43 +68,43 @@ ADD_CUSTOM_COMMAND(
DEPENDS ../VC++Files/sql/message.mc)
# MySql_version.h.
ADD_CUSTOM_COMMAND(
SOURCE ${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
OUTPUT ${CMAKE_SOURCE_DIR}/include/mysql_version.h
COMMAND ${CMAKE_SOURCE_DIR}/win/config-version.js
DEPENDS ${CMAKE_SOURCE_DIR}/include/mysql_version.h.in)
#ADD_CUSTOM_COMMAND(
# SOURCE ${PROJECT_SOURCE_DIR}/include/mysql_version.h.in
# OUTPUT ${PROJECT_SOURCE_DIR}/include/mysql_version.h
# COMMAND ${PROJECT_SOURCE_DIR}/win/config-version.js
# DEPENDS ${PROJECT_SOURCE_DIR}/include/mysql_version.h.in)
# Handlerton file
ADD_CUSTOM_COMMAND(
SOURCE ${CMAKE_SOURCE_DIR}/sql/handlerton.cc.in
OUTPUT ${CMAKE_SOURCE_DIR}/sql/handlerton.cc
COMMAND ${CMAKE_SOURCE_DIR}/win/config-handlerton.js ARGS ${CMAKE_SOURCE_DIR}/win/configure.data
DEPENDS ${CMAKE_SOURCE_DIR}/sql/handlerton.cc.in)
SOURCE ${PROJECT_SOURCE_DIR}/sql/handlerton.cc.in
OUTPUT ${PROJECT_SOURCE_DIR}/sql/handlerton.cc
COMMAND ${PROJECT_SOURCE_DIR}/win/config-handlerton.js ARGS ${PROJECT_SOURCE_DIR}/win/configure.data
DEPENDS ${PROJECT_SOURCE_DIR}/sql/handlerton.cc.in)
# Error file
GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION)
ADD_CUSTOM_COMMAND(
SOURCE ${CMAKE_SOURCE_DIR}/sql/share/errmsg.txt
OUTPUT ${CMAKE_SOURCE_DIR}/include/mysqld_error.h
SOURCE ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt
OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
COMMAND ${COMP_ERR_EXE}
ARGS --charset=${CMAKE_SOURCE_DIR}/sql/share/charsets
--out-dir=${CMAKE_SOURCE_DIR}/sql/share/
--header_file=${CMAKE_SOURCE_DIR}/include/mysqld_error.h
--name_file=${CMAKE_SOURCE_DIR}/include/mysqld_ername.h
--state_file=${CMAKE_SOURCE_DIR}/include/sql_state.h
--in_file=${CMAKE_SOURCE_DIR}/sql/share/errmsg.txt
ARGS --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets
--out-dir=${PROJECT_SOURCE_DIR}/sql/share/
--header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h
--name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
--state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h
--in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt
DEPENDS ${COMP_ERR_EXE} share/errmsg.txt)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_SOURCE_DIR}/include/mysqld_ername.h
OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
COMMAND echo
DEPENDS ${CMAKE_SOURCE_DIR}/include/mysqld_error.h
DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_SOURCE_DIR}/include/sql_state.h
OUTPUT ${PROJECT_SOURCE_DIR}/include/sql_state.h
COMMAND echo
DEPENDS ${CMAKE_SOURCE_DIR}/include/mysqld_ername.h
DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
)
......@@ -112,7 +113,9 @@ ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
TARGET_LINK_LIBRARIES(gen_lex_hash dbug mysqlclient wsock32)
GET_TARGET_PROPERTY(GEN_LEX_HASH_EXE gen_lex_hash LOCATION)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_SOURCE_DIR}/sql/lex_hash.h
OUTPUT ${PROJECT_SOURCE_DIR}/sql/lex_hash.h
COMMAND ${GEN_LEX_HASH_EXE} ARGS > lex_hash.h
DEPENDS ${GEN_LEX_HASH_EXE}
)
ADD_DEPENDENCIES(mysqld gen_lex_hash)
INCLUDE_DIRECTORIES(../mySTL include)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /GX-")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GX-")
ADD_LIBRARY(taocrypt src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp
src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp
src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp
......
SET(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR")
SET(CMAKE_C_FLAGS_DEBUG "-D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR")
SET(CMAKE_CXX_FLAGS_RELEASE "-DDBUG_OFF -DNDEBUG")
SET(CMAKE_C_FLAGS_RELEASE "-DDBUG_OFF -DNDEBUG")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR")
ADD_DEFINITIONS(-D_WINDOWS -D__WIN__)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/extra/yassl/include)
......
SET(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG __WIN32__")
SET(CMAKE_C_FLAGS_DEBUG "-D_DEBUG __WIN32__")
SET(CMAKE_CXX_FLAGS_RELEASE "-DDBUG_OFF -DNDEBUG")
SET(CMAKE_C_FLAGS_RELEASE "-DDBUG_OFF -DNDEBUG")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -D __WIN32__")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -D __WIN32__")
ADD_DEFINITIONS(-DUSE_TLS -DMYSQL_CLIENT -D_WINDOWS -D__WIN__)
ADD_LIBRARY(zlib adler32.c compress.c crc32.c crc32.h deflate.c deflate.h gzio.c infback.c inffast.c inffast.h
......
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