Commit 6df2af22 authored by Ignacio Galarza's avatar Ignacio Galarza

Bug#17270 - mysql client tool could not find ../share/charsets folder and fails.

- Define and pass compile time path variables as pre-processor definitions to 
  mimic the makefile build.
- Set new CMake version and policy requirements explicitly.
- Changed DATADIR to MYSQL_DATADIR to avoid conflicting definition in 
  Platform SDK header ObjIdl.h which also defines DATADIR.
parent ba904216
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR) CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
IF(COMMAND cmake_policy)
cmake_policy(SET CMP0005 NEW)
ENDIF(COMMAND cmake_policy)
PROJECT(MySql) PROJECT(MySql)
...@@ -26,6 +29,13 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in ...@@ -26,6 +29,13 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
# Set standard options # Set standard options
ADD_DEFINITIONS(-DCMAKE_BUILD) ADD_DEFINITIONS(-DCMAKE_BUILD)
ADD_DEFINITIONS(-DHAVE_YASSL) ADD_DEFINITIONS(-DHAVE_YASSL)
ADD_DEFINITIONS(-DCMAKE_CONFIGD)
ADD_DEFINITIONS(-DDEFAULT_MYSQL_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
ADD_DEFINITIONS(-DDEFAULT_BASEDIR="c:/Program Files/MySQL/")
ADD_DEFINITIONS(-DMYSQL_DATADIR="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/data")
ADD_DEFINITIONS(-DDEFAULT_CHARSET_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
ADD_DEFINITIONS(-DPACKAGE=mysql)
ADD_DEFINITIONS(-DSHAREDIR="share")
# Set debug options # Set debug options
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFORCE_INIT_OF_VARS") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFORCE_INIT_OF_VARS")
......
...@@ -57,7 +57,7 @@ strings_src=decimal.c ...@@ -57,7 +57,7 @@ strings_src=decimal.c
# Fix for mit-threads # Fix for mit-threads
DEFS = -DUNDEF_THREADS_HACK \ DEFS = -DUNDEF_THREADS_HACK \
-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \ -DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
-DDATADIR="\"$(localstatedir)\"" -DMYSQL_DATADIR="\"$(localstatedir)\""
EXTRA_DIST = get_password.c CMakeLists.txt echo.c EXTRA_DIST = get_password.c CMakeLists.txt echo.c
......
...@@ -110,7 +110,7 @@ extern "C" { ...@@ -110,7 +110,7 @@ extern "C" {
#define DEFAULT_BASEDIR "sys:/" #define DEFAULT_BASEDIR "sys:/"
#define SHAREDIR "share/" #define SHAREDIR "share/"
#define DEFAULT_CHARSET_HOME "sys:/mysql/" #define DEFAULT_CHARSET_HOME "sys:/mysql/"
#define DATADIR "data/" #define MYSQL_DATADIR "data/"
/* 64-bit file system calls */ /* 64-bit file system calls */
#define SIZEOF_OFF_T 8 #define SIZEOF_OFF_T 8
......
...@@ -303,13 +303,15 @@ inline ulonglong double2ulonglong(double d) ...@@ -303,13 +303,15 @@ inline ulonglong double2ulonglong(double d)
#ifdef _CUSTOMCONFIG_ #ifdef _CUSTOMCONFIG_
#include <custom_conf.h> #include <custom_conf.h>
#else #else
#ifndef CMAKE_CONFIGD
#define DEFAULT_MYSQL_HOME "c:\\mysql" #define DEFAULT_MYSQL_HOME "c:\\mysql"
#define DATADIR "c:\\mysql\\data" #define MYSQL_DATADIR "c:\\mysql\\data"
#define PACKAGE "mysql" #define PACKAGE "mysql"
#define DEFAULT_BASEDIR "C:\\" #define DEFAULT_BASEDIR "C:\\"
#define SHAREDIR "share" #define SHAREDIR "share"
#define DEFAULT_CHARSET_HOME "C:/mysql/" #define DEFAULT_CHARSET_HOME "C:/mysql/"
#endif #endif
#endif
#ifndef DEFAULT_HOME_ENV #ifndef DEFAULT_HOME_ENV
#define DEFAULT_HOME_ENV MYSQL_HOME #define DEFAULT_HOME_ENV MYSQL_HOME
#endif #endif
......
...@@ -82,7 +82,7 @@ vio_objects= vio.lo viosocket.lo viossl.lo viosslfactories.lo ...@@ -82,7 +82,7 @@ vio_objects= vio.lo viosocket.lo viossl.lo viosslfactories.lo
CLEANFILES = $(target_libadd) $(SHLIBOBJS) \ CLEANFILES = $(target_libadd) $(SHLIBOBJS) \
$(target) $(target)
DEFS = -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \ DEFS = -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \ -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_HOME_ENV=MYSQL_HOME \ -DDEFAULT_HOME_ENV=MYSQL_HOME \
-DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \ -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
-DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \ -DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \
......
...@@ -23,7 +23,7 @@ MYSQLBASEdir= $(prefix) ...@@ -23,7 +23,7 @@ MYSQLBASEdir= $(prefix)
DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \ -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \ -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" -DSHAREDIR="\"$(MYSQLSHAREdir)\""
INCLUDES= @bdb_includes@ @innodb_includes@ @ndbcluster_includes@ \ INCLUDES= @bdb_includes@ @innodb_includes@ @ndbcluster_includes@ \
-I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/include -I$(top_srcdir)/include \
......
...@@ -66,7 +66,7 @@ libmysys_a_LIBADD = @THREAD_LOBJECTS@ ...@@ -66,7 +66,7 @@ libmysys_a_LIBADD = @THREAD_LOBJECTS@
# charset2html_DEPENDENCIES= $(LIBRARIES) # charset2html_DEPENDENCIES= $(LIBRARIES)
EXTRA_PROGRAMS = EXTRA_PROGRAMS =
DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \ DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \ -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \ -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DDEFAULT_HOME_ENV=MYSQL_HOME \ -DDEFAULT_HOME_ENV=MYSQL_HOME \
......
...@@ -48,7 +48,7 @@ LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CommandInterpreter.lo \ ...@@ -48,7 +48,7 @@ LDADD_LOC = $(top_builddir)/ndb/src/mgmclient/CommandInterpreter.lo \
@TERMCAP_LIB@ @TERMCAP_LIB@
DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \ DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \ -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DMYSQLCLUSTERDIR="\"$(MYSQLCLUSTERdir)\"" -DMYSQLCLUSTERDIR="\"$(MYSQLCLUSTERdir)\""
......
...@@ -114,7 +114,7 @@ mysql_tzinfo_to_sql_LDADD = @MYSQLD_EXTRA_LDFLAGS@ $(LDADD) $(CXXLDFLAGS) ...@@ -114,7 +114,7 @@ mysql_tzinfo_to_sql_LDADD = @MYSQLD_EXTRA_LDFLAGS@ $(LDADD) $(CXXLDFLAGS)
DEFS = -DMYSQL_SERVER \ DEFS = -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \ -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \ -DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
@DEFS@ @DEFS@
......
...@@ -6865,7 +6865,7 @@ static void mysql_init_variables(void) ...@@ -6865,7 +6865,7 @@ static void mysql_init_variables(void)
/* Set directory paths */ /* Set directory paths */
strmake(language, LANGUAGE, sizeof(language)-1); strmake(language, LANGUAGE, sizeof(language)-1);
strmake(mysql_real_data_home, get_relative_path(DATADIR), strmake(mysql_real_data_home, get_relative_path(MYSQL_DATADIR),
sizeof(mysql_real_data_home)-1); sizeof(mysql_real_data_home)-1);
mysql_data_home_buff[0]=FN_CURLIB; // all paths are relative from here mysql_data_home_buff[0]=FN_CURLIB; // all paths are relative from here
mysql_data_home_buff[1]=0; mysql_data_home_buff[1]=0;
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
#define TEMP_PREFIX "MY" #define TEMP_PREFIX "MY"
#define LOG_PREFIX "ML" #define LOG_PREFIX "ML"
#define PROGDIR "bin/" #define PROGDIR "bin/"
#ifndef DATADIR #ifndef MYSQL_DATADIR
#define DATADIR "data/" #define MYSQL_DATADIR "data/"
#endif #endif
#ifndef SHAREDIR #ifndef SHAREDIR
#define SHAREDIR "share/" #define SHAREDIR "share/"
......
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