Back to home page

MySQL Cross Reference

 
 

    


0001 # Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
0002 # 
0003 # This program is free software; you can redistribute it and/or modify
0004 # it under the terms of the GNU General Public License as published by
0005 # the Free Software Foundation; version 2 of the License.
0006 # 
0007 # This program is distributed in the hope that it will be useful,
0008 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0009 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0010 # GNU General Public License for more details.
0011 # 
0012 # You should have received a copy of the GNU General Public License
0013 # along with this program; if not, write to the Free Software
0014 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
0015 
0016 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
0017 # Avoid warnings in higher versions
0018 if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6)
0019  CMAKE_POLICY(VERSION 2.8)
0020 endif()
0021 
0022 MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")
0023 
0024 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
0025 
0026 # First, decide about build type (debug or release)
0027 # If custom compiler flags are set or cmake is invoked with -DCMAKE_BUILD_TYPE, 
0028 # respect user wishes and do not (re)define CMAKE_BUILD_TYPE. If WITH_DEBUG{_FULL} 
0029 # is given, set CMAKE_BUILD_TYPE = Debug. Otherwise, use Relwithdebinfo.
0030 
0031 
0032 IF(DEFINED CMAKE_BUILD_TYPE)
0033   SET(HAVE_CMAKE_BUILD_TYPE TRUE)
0034 ENDIF()
0035 SET(CUSTOM_C_FLAGS $ENV{CFLAGS})
0036 
0037 OPTION(WITH_DEBUG "Use dbug/safemutex" OFF)
0038 
0039 # Distinguish between community and non-community builds, with the
0040 # default being a community build. This does not impact the feature
0041 # set that will be compiled in; it's merely provided as a hint to
0042 # custom packaging steps.
0043 OPTION(COMMUNITY_BUILD "Set to true if this is a community build" ON) 
0044 
0045 # Use a default manufacturer if no manufacturer was identified.
0046 SET(MANUFACTURER_DOCSTRING
0047   "Set the entity that appears as the manufacturer of packages that support a manufacturer field.")
0048 IF(NOT DEFINED MANUFACTURER) 
0049   SET(MANUFACTURER "Built from Source" CACHE  STRING ${MANUFACTURER_DOCSTRING})
0050   MARK_AS_ADVANCED(MANUFACTURER)
0051 ENDIF()
0052 
0053 # We choose to provide WITH_DEBUG as alias to standard CMAKE_BUILD_TYPE=Debug
0054 # which turns out to be not trivial, as this involves synchronization 
0055 # between CMAKE_BUILD_TYPE and WITH_DEBUG. Besides, we have to deal with cases
0056 # where WITH_DEBUG is  reset from ON to OFF  and here we need to reset 
0057 # CMAKE_BUILD_TYPE to either none or default RelWithDebInfo
0058 
0059 SET(BUILDTYPE_DOCSTRING
0060  "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
0061  CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel")
0062 
0063 # Possibly temporary fix: Clang on 32 bit causes non-debug server to crash
0064 IF(CMAKE_OSX_ARCHITECTURES MATCHES "i386")
0065   SET(CMAKE_CXX_COMPILER g++)
0066 ENDIF()
0067 
0068 IF(WITH_DEBUG)
0069   SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING ${BUILDTYPE_DOCSTRING} FORCE)
0070   SET(MYSQL_MAINTAINER_MODE ON CACHE BOOL
0071       "MySQL maintainer-specific development environment")
0072   IF(UNIX AND NOT APPLE)
0073     # Compiling with PIC speeds up embedded build, on PIC sensitive systems 
0074     # Predefine it to ON, in case user chooses to build embedded. 
0075     SET(WITH_PIC ON CACHE BOOL "Compile with PIC")
0076   ENDIF()
0077   SET(OLD_WITH_DEBUG 1 CACHE INTERNAL "" FORCE)
0078 ELSEIF(NOT HAVE_CMAKE_BUILD_TYPE OR OLD_WITH_DEBUG)
0079   IF(CUSTOM_C_FLAGS)
0080     SET(CMAKE_BUILD_TYPE "" CACHE STRING ${BUILDTYPE_DOCSTRING} FORCE)
0081   ELSE(CMAKE_BUILD_TYPE MATCHES "Debug" OR NOT HAVE_CMAKE_BUILD_TYPE)
0082     SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING 
0083        ${BUILDTYPE_DOCSTRING} FORCE)
0084   ENDIF()
0085   SET(OLD_WITH_DEBUG 0 CACHE INTERNAL "" FORCE)
0086 ENDIF()
0087 
0088 # Optionally set project name, e.g.
0089 # foo.xcodeproj (mac) or foo.sln (windows)
0090 SET(MYSQL_PROJECT_NAME_DOCSTRING "MySQL project name")
0091 IF(DEFINED MYSQL_PROJECT_NAME)
0092   SET(MYSQL_PROJECT_NAME ${MYSQL_PROJECT_NAME} CACHE STRING
0093       ${MYSQL_PROJECT_NAME_DOCSTRING} FORCE)
0094 ELSE()
0095   SET(MYSQL_PROJECT_NAME "MySQL" CACHE STRING
0096       ${MYSQL_PROJECT_NAME_DOCSTRING} FORCE)
0097   MARK_AS_ADVANCED(MYSQL_PROJECT_NAME)
0098 ENDIF()
0099 PROJECT(${MYSQL_PROJECT_NAME})
0100 
0101 OPTION(WITH_DEFAULT_COMPILER_OPTIONS
0102   "Use flags from cmake/build_configurations/compiler_options.cmake"
0103   ON)
0104 OPTION(WITH_DEFAULT_FEATURE_SET
0105   "Use feature set in cmake/build_configurations/feature_set.cmake"
0106   ON)
0107 IF(BUILD_CONFIG)
0108   INCLUDE(
0109   ${CMAKE_SOURCE_DIR}/cmake/build_configurations/${BUILD_CONFIG}.cmake)
0110 ENDIF()
0111 
0112 #cmake on 64bit windows/mac/solaris doesn't set CMAKE_SYSTEM_PROCESSOR correctly
0113 SET(MYSQL_MACHINE_TYPE ${CMAKE_SYSTEM_PROCESSOR})
0114 
0115 
0116 # Include the platform-specific file. To allow exceptions, this code
0117 # looks for files in order of how specific they are. If there is, for
0118 # example, a generic Linux.cmake and a version-specific
0119 # Linux-2.6.28-11-generic, it will pick Linux-2.6.28-11-generic and
0120 # include it. It is then up to the file writer to include the generic
0121 # version if necessary.
0122 FOREACH(_base
0123     ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}-${CMAKE_SYSTEM_PROCESSOR}
0124     ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}
0125     ${CMAKE_SYSTEM_NAME})
0126   SET(_file ${CMAKE_SOURCE_DIR}/cmake/os/${_base}.cmake)
0127   IF(EXISTS ${_file})
0128     INCLUDE(${_file})
0129     BREAK()
0130   ENDIF()
0131 ENDFOREACH()
0132 
0133 
0134 IF(UNIX)
0135   OPTION(WITH_INNODB_MEMCACHED "" OFF)
0136   OPTION(ENABLE_MEMCACHED_SASL "Enable SASL on InnoDB Memcached" OFF)
0137   OPTION(ENABLE_MEMCACHED_SASL_PWDB "Enable SASL on InnoDB Memcached" OFF)
0138 ELSE()
0139   OPTION(WITH_INNODB_MEMCACHED "" OFF)
0140 ENDIF()
0141  
0142 # Following autotools tradition, add preprocessor definitions
0143 # specified in environment variable CPPFLAGS
0144 IF(DEFINED ENV{CPPFLAGS})
0145   ADD_DEFINITIONS($ENV{CPPFLAGS})
0146 ENDIF()
0147 
0148 INCLUDE(CheckTypeSize)
0149 CHECK_TYPE_SIZE("void *" SIZEOF_VOIDP)
0150 IF(WITH_DEFAULT_COMPILER_OPTIONS)
0151   INCLUDE(${CMAKE_SOURCE_DIR}/cmake/build_configurations/compiler_options.cmake)
0152 ENDIF()
0153 IF(WITH_DEFAULT_FEATURE_SET)
0154   INCLUDE(${CMAKE_SOURCE_DIR}/cmake/build_configurations/feature_set.cmake)
0155 ENDIF()
0156 
0157 #
0158 # Control aspects of the development environment which are
0159 # specific to MySQL maintainers and developers.
0160 #
0161 INCLUDE(maintainer)
0162 
0163 OPTION(MYSQL_MAINTAINER_MODE
0164        "MySQL maintainer-specific development environment" OFF)
0165 
0166 # Whether the maintainer mode compiler options should be enabled.
0167 IF(MYSQL_MAINTAINER_MODE)
0168   IF(CMAKE_C_COMPILER_ID MATCHES "GNU")
0169     IF(WITH_INNODB_MEMCACHED)
0170       SET_MYSQL_MAINTAINER_GNU_C_OPTIONS_NO_WERROR()
0171     ELSE()
0172       SET_MYSQL_MAINTAINER_GNU_C_OPTIONS()
0173     ENDIF()
0174   ENDIF()
0175   IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
0176     SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS()
0177   ENDIF()
0178   IF(CMAKE_C_COMPILER_ID MATCHES "Intel")
0179     SET_MYSQL_MAINTAINER_INTEL_C_OPTIONS()
0180   ENDIF()
0181   IF(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
0182     SET_MYSQL_MAINTAINER_INTEL_CXX_OPTIONS()
0183   ENDIF()
0184 ENDIF()
0185 
0186 # Add macros
0187 INCLUDE(character_sets)
0188 INCLUDE(cpu_info)
0189 INCLUDE(zlib)
0190 INCLUDE(libevent)
0191 INCLUDE(ssl)
0192 INCLUDE(readline)
0193 INCLUDE(mysql_version)
0194 INCLUDE(libutils)
0195 INCLUDE(dtrace)
0196 INCLUDE(plugin)
0197 INCLUDE(install_macros)
0198 INCLUDE(install_layout)
0199 INCLUDE(mysql_add_executable)
0200 
0201 # Handle options
0202 OPTION(DISABLE_SHARED 
0203  "Don't build shared libraries, compile code as position-dependent" OFF)
0204 IF(DISABLE_SHARED)
0205   SET(WITHOUT_DYNAMIC_PLUGINS 1)
0206 ENDIF()
0207 OPTION(ENABLED_PROFILING "Enable profiling" ON)
0208 OPTION(CYBOZU "" OFF)
0209 OPTION(BACKUP_TEST "" OFF)
0210 OPTION(WITHOUT_SERVER OFF)
0211 IF(UNIX)
0212   OPTION(WITH_VALGRIND "Valgrind instrumentation" OFF)
0213 ENDIF()
0214 OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
0215 MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED)
0216 
0217 OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON) 
0218 IF(ENABLE_DEBUG_SYNC) 
0219   SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") 
0220   SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") 
0221 ENDIF() 
0222  
0223 # Older versions of ccache must be disabled: export CCACHE_DISABLE=1
0224 # See http://www.cmake.org/Wiki/CTest/Coverage
0225 OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF)
0226 IF (ENABLE_GCOV AND NOT WIN32 AND NOT APPLE)
0227   SET(CMAKE_CXX_FLAGS_DEBUG
0228     "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -DHAVE_GCOV")
0229   SET(CMAKE_C_FLAGS_DEBUG
0230     "${CMAKE_C_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -DHAVE_GCOV")
0231   SET(CMAKE_EXE_LINKER_FLAGS_DEBUG
0232     "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage -lgcov")
0233 ENDIF()
0234 
0235 OPTION(ENABLE_GPROF "Enable gprof (optimized, Linux builds only)" OFF)
0236 IF (ENABLE_GPROF AND NOT WIN32 AND NOT APPLE)
0237   SET(CMAKE_C_FLAGS_RELWITHDEBINFO
0238     "${CMAKE_C_FLAGS_RELWITHDEBINFO} -pg")
0239   SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO
0240     "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -pg")
0241   SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
0242     "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -pg")
0243 ENDIF()
0244 
0245 OPTION(ENABLED_LOCAL_INFILE
0246  "If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
0247 MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE)
0248 
0249 OPTION(WITH_FAST_MUTEXES "Compile with fast mutexes" OFF)
0250 MARK_AS_ADVANCED(WITH_FAST_MUTEXES)
0251 
0252 OPTION(OPTIMIZER_TRACE "Support tracing of Optimizer" ON)
0253 
0254 OPTION(INNODB_COMPILER_HINTS "Compile InnoDB with compiler hints" ON)
0255 MARK_AS_ADVANCED(INNODB_COMPILER_HINTS)
0256 
0257 # Set DBUG_OFF and other optional release-only flags for non-debug project types
0258 FOREACH(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL)
0259   FOREACH(LANG C CXX)
0260     SET(CMAKE_${LANG}_FLAGS_${BUILD_TYPE} 
0261      "${CMAKE_${LANG}_FLAGS_${BUILD_TYPE}} -DDBUG_OFF")
0262     IF(WITH_FAST_MUTEXES)
0263       SET(CMAKE_${LANG}_FLAGS_${BUILD_TYPE} 
0264         "${CMAKE_${LANG}_FLAGS_${BUILD_TYPE}} -DMY_PTHREAD_FASTMUTEX=1")
0265     ENDIF()
0266   ENDFOREACH()
0267 ENDFOREACH()
0268 
0269 IF(NOT CMAKE_BUILD_TYPE
0270     AND NOT CMAKE_GENERATOR MATCHES "Visual Studio" 
0271     AND NOT CMAKE_GENERATOR MATCHES "Xcode") 
0272     # This is the case of no CMAKE_BUILD_TYPE choosen, typical for VS and Xcode
0273     # or if custom C flags are set. In VS and Xcode for non-Debug configurations 
0274     # DBUG_OFF is already correctly set. Use DBUG_OFF for Makefile based projects 
0275     # without build type too, unless user specifically requests DBUG. 
0276     IF(NOT CMAKE_C_FLAGS MATCHES "-DDBUG_ON")
0277       ADD_DEFINITIONS(-DDBUG_OFF)
0278     ENDIF()
0279 ENDIF()
0280 
0281 # Add safemutex for debug configurations, except on Windows
0282 # (safemutex has never worked on Windows)
0283 IF(WITH_DEBUG AND NOT WIN32 AND NOT WITH_INNODB_MEMCACHED)
0284   FOREACH(LANG C CXX)
0285       SET(CMAKE_${LANG}_FLAGS_DEBUG
0286           "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
0287   ENDFOREACH()
0288 ENDIF()
0289 
0290 
0291 # Set commonly used variables
0292 IF(WIN32)
0293   SET(DEFAULT_MYSQL_HOME "C:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}" )
0294   SET(SHAREDIR share)
0295 ELSE()
0296   SET(DEFAULT_MYSQL_HOME ${CMAKE_INSTALL_PREFIX})
0297   SET(SHAREDIR ${DEFAULT_MYSQL_HOME}/${INSTALL_MYSQLSHAREDIR})
0298 ENDIF()
0299 
0300 SET(DEFAULT_BASEDIR "${DEFAULT_MYSQL_HOME}")
0301 IF(INSTALL_MYSQLDATADIR MATCHES "^/.*")
0302   SET(MYSQL_DATADIR ${INSTALL_MYSQLDATADIR} CACHE PATH "default MySQL data directory")
0303 ELSE()
0304   SET(MYSQL_DATADIR "${DEFAULT_MYSQL_HOME}/${INSTALL_MYSQLDATADIR}" CACHE PATH "default MySQL data directory")
0305 ENDIF()
0306 SET(DEFAULT_CHARSET_HOME "${DEFAULT_MYSQL_HOME}")
0307 SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}")
0308 IF(SYSCONFDIR)
0309   SET(DEFAULT_SYSCONFDIR "${SYSCONFDIR}")
0310 ENDIF()
0311 
0312 
0313 # Run platform tests
0314 INCLUDE(configure.cmake)
0315 
0316 # Common defines and includes
0317 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
0318 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
0319 
0320 # Add bundled or system zlib.
0321 MYSQL_CHECK_ZLIB_WITH_COMPRESS()
0322 # Add bundled yassl/taocrypt or system openssl.
0323 MYSQL_CHECK_SSL()
0324 # Add readline or libedit.
0325 MYSQL_CHECK_READLINE()
0326 # Add libevent
0327 MYSQL_CHECK_LIBEVENT()
0328 
0329 #
0330 # Setup maintainer mode options by the end. Platform checks are
0331 # not run with the warning options as to not perturb fragile checks
0332 # (i.e. do not make warnings into errors).
0333 #
0334 # Why doesn't these flags affect the entire build?
0335 # Because things may already have been included with ADD_SUBDIRECTORY
0336 #
0337 IF(MYSQL_MAINTAINER_MODE)
0338   # Set compiler flags required under maintainer mode.
0339   MESSAGE(STATUS "C warning options: ${MY_MAINTAINER_C_WARNINGS}")
0340   SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_MAINTAINER_C_WARNINGS}")
0341   MESSAGE(STATUS "C++ warning options: ${MY_MAINTAINER_CXX_WARNINGS}")
0342   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_MAINTAINER_CXX_WARNINGS}")
0343 ENDIF()
0344 
0345 IF(CMAKE_COMPILER_IS_GNUCXX)
0346   STRING(REGEX MATCH "-Werror"
0347     BUILD_WITH_WERROR ${CMAKE_CXX_FLAGS})
0348   IF(BUILD_WITH_WERROR)
0349     SET("COMPILE_FLAG_WERROR" 1)
0350   ENDIF()
0351 ENDIF()
0352 
0353 IF(WITH_UNIT_TESTS)
0354  ENABLE_TESTING()
0355 ENDIF()
0356 
0357 IF(NOT WITHOUT_SERVER)
0358 SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
0359  # Add storage engines and plugins.
0360  CONFIGURE_PLUGINS()
0361 ENDIF()
0362 
0363 ADD_SUBDIRECTORY(include)
0364 ADD_SUBDIRECTORY(dbug)
0365 ADD_SUBDIRECTORY(strings)
0366 ADD_SUBDIRECTORY(vio)
0367 ADD_SUBDIRECTORY(regex)
0368 ADD_SUBDIRECTORY(mysys)
0369 ADD_SUBDIRECTORY(mysys_ssl)
0370 ADD_SUBDIRECTORY(libmysql)
0371 
0372 IF(WITH_UNIT_TESTS)
0373   ADD_SUBDIRECTORY(unittest)
0374   ADD_SUBDIRECTORY(unittest/examples)
0375   ADD_SUBDIRECTORY(unittest/mytap)
0376   ADD_SUBDIRECTORY(unittest/mytap/t)
0377   ADD_SUBDIRECTORY(unittest/gunit)
0378 ENDIF()
0379 
0380 ADD_SUBDIRECTORY(extra)
0381 IF(NOT WITHOUT_SERVER)
0382   ADD_SUBDIRECTORY(tests)
0383   ADD_SUBDIRECTORY(client)
0384   ADD_SUBDIRECTORY(sql)
0385   ADD_SUBDIRECTORY(sql/share)
0386   ADD_SUBDIRECTORY(libservices)
0387   OPTION (WITH_EMBEDDED_SERVER "Compile MySQL with embedded server" OFF)
0388   IF(WITH_EMBEDDED_SERVER) 
0389    ADD_SUBDIRECTORY(libmysqld)
0390    ADD_SUBDIRECTORY(libmysqld/examples)
0391   ENDIF(WITH_EMBEDDED_SERVER)
0392 
0393   ADD_SUBDIRECTORY(mysql-test)
0394   ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)
0395   ADD_SUBDIRECTORY(support-files)
0396   ADD_SUBDIRECTORY(scripts)
0397   ADD_SUBDIRECTORY(sql-bench)
0398   IF(UNIX)
0399     ADD_SUBDIRECTORY(man)
0400   ENDIF()
0401   IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt)
0402     ADD_SUBDIRECTORY(internal)
0403   ENDIF()
0404   ADD_SUBDIRECTORY(packaging/rpm-uln)
0405 ENDIF()
0406 
0407 INCLUDE(cmake/abi_check.cmake)
0408 INCLUDE(cmake/tags.cmake)
0409 
0410 CONFIGURE_FILE(config.h.cmake   ${CMAKE_BINARY_DIR}/include/my_config.h)
0411 CONFIGURE_FILE(config.h.cmake   ${CMAKE_BINARY_DIR}/include/config.h)
0412 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
0413                ${CMAKE_BINARY_DIR}/include/mysql_version.h )
0414 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc.in
0415     ${CMAKE_BINARY_DIR}/sql/sql_builtin.cc)
0416 CONFIGURE_FILE(
0417     ${CMAKE_SOURCE_DIR}/cmake/info_macros.cmake.in ${CMAKE_BINARY_DIR}/info_macros.cmake @ONLY)
0418 
0419 # Handle the "INFO_*" files.
0420 INCLUDE(${CMAKE_BINARY_DIR}/info_macros.cmake)
0421 # Source: This can be done during the cmake phase, all information is
0422 # available, but should be repeated on each "make" just in case someone
0423 # does "cmake ; make ; bzr pull ; make".
0424 CREATE_INFO_SRC(${CMAKE_BINARY_DIR}/Docs)
0425 ADD_CUSTOM_TARGET(INFO_SRC ALL
0426   COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/info_src.cmake
0427   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
0428 )
0429 # Build flags: This must be postponed to the make phase.
0430 ADD_CUSTOM_TARGET(INFO_BIN ALL
0431   COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/info_bin.cmake
0432   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
0433 )
0434 
0435 # Packaging
0436 IF(WIN32)
0437   SET(CPACK_GENERATOR "ZIP")
0438 ELSE()
0439   SET(CPACK_GENERATOR "TGZ")
0440 ENDIF() 
0441 ADD_SUBDIRECTORY(packaging/WiX)
0442 ADD_SUBDIRECTORY(packaging/solaris)
0443 
0444 # Create a single package with "make package"
0445 # (see http://public.kitware.com/Bug/view.php?id=11452)
0446 SET(CPACK_MONOLITHIC_INSTALL 1 CACHE INTERNAL "")
0447 
0448 INCLUDE(CPack)
0449 IF(UNIX)
0450   INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL COMPONENT Info)
0451 ENDIF()
0452 #
0453 # RPM installs documentation directly from the source tree
0454 #
0455 IF(NOT INSTALL_LAYOUT MATCHES "RPM")
0456   INSTALL(FILES COPYING LICENSE.mysql 
0457   DESTINATION ${INSTALL_DOCREADMEDIR} 
0458   COMPONENT Readme
0459   OPTIONAL
0460   )
0461   INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme)
0462   INSTALL(FILES ${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN DESTINATION ${INSTALL_DOCDIR})
0463   IF(UNIX)
0464     INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme)
0465   ENDIF()
0466   # MYSQL_DOCS_LOCATON is used in "make dist", points to the documentation directory
0467   SET(MYSQL_DOCS_LOCATION "" CACHE PATH "Location from where documentation is copied")
0468   MARK_AS_ADVANCED(MYSQL_DOCS_LOCATION)
0469   INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR}
0470     COMPONENT Documentation
0471     PATTERN "INSTALL-BINARY" EXCLUDE
0472     PATTERN "Makefile.*" EXCLUDE
0473     PATTERN "glibc*" EXCLUDE
0474     PATTERN "linuxthreads.txt" EXCLUDE
0475     PATTERN "myisam.txt" EXCLUDE
0476     PATTERN "mysql.info" EXCLUDE
0477     PATTERN "sp-imp-spec.txt" EXCLUDE
0478   )
0479 ENDIF()