From a15d4127fd115069f4322a9ebd4db67af39c977f Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 16 Nov 2009 14:45:06 +0100 Subject: [PATCH] Fixes for cmake2.8 --- cmake/create_initial_db.cmake.in | 23 ++++++++++------------- configure.cmake | 3 ++- scripts/CMakeLists.txt | 15 +++++++-------- sql/CMakeLists.txt | 7 +++++-- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cmake/create_initial_db.cmake.in b/cmake/create_initial_db.cmake.in index 92ebc72d425..649d96a6627 100644 --- a/cmake/create_initial_db.cmake.in +++ b/cmake/create_initial_db.cmake.in @@ -19,16 +19,14 @@ SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@") SET(MYSQLD_EXECUTABLE "@MYSQLD_EXECUTABLE@") SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@") SET(WIN32 "@WIN32@") -SET ($ENV{VS_UNICODE_OUTPUT}) -IF(CMAKE_CFG_INTDIR) - IF(CONFIG) - MESSAGE(${CONFIG}) - #Resolve build configuration variables - STRING(REPLACE "${CMAKE_CFG_INTDIR}" ${CONFIG} MYSQLD_EXECUTABLE - "${MYSQLD_EXECUTABLE}") - ELSE() - MESSAGE(FATAL_ERROR "Please provide CONFIG parameter to the script") - ENDIF() +# Force Visual Studio to output to stdout +IF(ENV{VS_UNICODE_OUTPUT}) + SET ($ENV{VS_UNICODE_OUTPUT}) +ENDIF() +IF(CMAKE_CFG_INTDIR AND CONFIG) + #Resolve build configuration variables + STRING(REPLACE "${CMAKE_CFG_INTDIR}" ${CONFIG} MYSQLD_EXECUTABLE + "${MYSQLD_EXECUTABLE}") ENDIF() # Create bootstrapper SQL script @@ -44,9 +42,8 @@ FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql ENDFOREACH() -MAKE_DIRECTORY(data) -FILE(REMOVE_RECURSE data/mysql) -MAKE_DIRECTORY(data/mysql) +FILE(REMOVE_RECURSE mysql) +MAKE_DIRECTORY(mysql) IF(WIN32) SET(CONSOLE --console) ENDIF() diff --git a/configure.cmake b/configure.cmake index aff4c1403f9..b35548b2e2f 100644 --- a/configure.cmake +++ b/configure.cmake @@ -209,7 +209,8 @@ IF(WIN32) ADD_DEFINITIONS("-DWIN32_LEAN_AND_MEAN") IF (MSVC_VERSION GREATER 1400) # Speed up multiprocessor build - ADD_DEFINITIONS("/MP") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") ENDIF() # default to x86 platform. We'll check for X64 in a bit diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 0403a1bb5ae..8d246e6a38a 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -76,13 +76,12 @@ SET(FIX_PRIVILEGES_SQL ) # Build mysql_fix_privilege_tables.sql (concatenate 2 sql scripts) -ADD_CUSTOM_COMMAND( - OUTPUT ${FIX_PRIVILEGES_SQL} - COMMAND ${CMAKE_COMMAND} "-DIN=${FIX_PRIVS_IN}" "-DOUT=${FIX_PRIVILEGES_SQL}" - -P "${CMAKE_SOURCE_DIR}/cmake/cat.cmake" - VERBATIM - DEPENDS ${FIX_PRIVS_IN} -) +FILE(WRITE ${FIX_PRIVILEGES_SQL} "") +FOREACH(FILENAME ${FIX_PRIVS_IN}) + FILE(READ "${FILENAME}" CONTENTS) + FILE(APPEND ${FIX_PRIVILEGES_SQL} "${CONTENTS}") +ENDFOREACH() + # Build mysql_fix_privilege_tables.c ADD_CUSTOM_COMMAND( @@ -91,7 +90,7 @@ ADD_CUSTOM_COMMAND( mysql_fix_privilege_tables mysql_fix_privilege_tables.sql mysql_fix_privilege_tables_sql.c - DEPENDS comp_sql ${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql + DEPENDS comp_sql WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 336f94c0718..c3aadc8def5 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -232,11 +232,14 @@ IF(WIN32 AND MYSQLD_EXECUTABLE) @ONLY ) + IF(MSVC_IDE OR CMAKE_GENERATOR MATCHES "Xcode") + SET (CONFIG_PARAM -DCONFIG=${CMAKE_CFG_INTDIR}) + ENDIF() MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/data) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/data/mysql/user.frm - COMMAND ${CMAKE_COMMAND} - -DCONFIG=${CMAKE_CFG_INTDIR} + COMMAND ${CMAKE_COMMAND} + ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DEPENDS mysqld