2018-01-01 00:40:17 +01:00
# Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
2010-06-09 15:39:34 +02:00
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2017-10-05 01:13:43 +02:00
# We require CMake >= 3.2
cmake_minimum_required ( VERSION 3.2 )
2016-03-14 15:27:33 +01:00
2017-10-05 00:44:00 +02:00
# add this options before PROJECT keyword
set ( CMAKE_DISABLE_SOURCE_CHANGES ON )
set ( CMAKE_DISABLE_IN_SOURCE_BUILD ON )
2010-08-28 18:49:17 +02:00
# Set projectname (must be done AFTER setting configurationtypes)
2010-07-29 21:08:16 +02:00
project ( TrinityCore )
2010-06-24 15:08:01 +02:00
2010-08-28 18:49:17 +02:00
# CMake policies (can not be handled elsewhere)
2013-01-29 23:18:25 +01:00
cmake_policy ( SET CMP0005 OLD )
2014-07-30 15:52:05 +01:00
if ( POLICY CMP0043 )
cmake_policy ( SET CMP0043 OLD ) # Disable 'Ignore COMPILE_DEFINITIONS_<Config> properties'
2016-04-05 17:55:32 +02:00
endif ()
if ( POLICY CMP0054 )
cmake_policy ( SET CMP0054 NEW ) # Only interpret if() arguments as variables or keywords when unquoted - prevents intepreting if (SOME_STRING_VARIABLE MATCHES "MSVC") as if (SOME_STRING_VARIABLE MATCHES "1")
endif ()
2013-01-29 15:53:21 +01:00
2010-08-28 18:49:17 +02:00
# Set RPATH-handing (CMake parameters)
set ( CMAKE_SKIP_BUILD_RPATH 0 )
set ( CMAKE_BUILD_WITH_INSTALL_RPATH 0 )
set ( CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" )
set ( CMAKE_INSTALL_RPATH_USE_LINK_PATH 1 )
2010-08-09 05:22:58 +02:00
2010-08-28 18:49:17 +02:00
# set macro-directory
2017-11-28 22:05:25 +01:00
list ( APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake/macros"
"${CMAKE_SOURCE_DIR}/dep/cotire/CMake" )
2010-06-24 15:08:01 +02:00
2010-08-28 18:49:17 +02:00
# build in Release-mode by default if not explicitly set
if ( NOT CMAKE_BUILD_TYPE )
2017-08-31 18:10:59 +02:00
set ( CMAKE_BUILD_TYPE "RelWithDebInfo" )
2010-06-24 15:08:01 +02:00
endif ()
2009-01-17 09:23:33 -05:00
2010-08-20 04:09:39 +02:00
include ( CheckCXXSourceRuns )
2009-06-29 00:47:19 +02:00
include ( CheckIncludeFiles )
2016-03-24 18:19:56 +01:00
include ( ConfigureScripts )
2010-08-28 21:42:07 +02:00
2010-08-28 23:19:43 +02:00
# set default buildoptions and print them
include ( cmake/options.cmake )
2010-08-28 21:42:07 +02:00
# turn off PCH totally if enabled (hidden setting, mainly for devs)
if ( NOPCH )
set ( USE_COREPCH 0 )
set ( USE_SCRIPTPCH 0 )
endif ()
2017-10-31 01:29:51 +01:00
include ( ConfigureBaseTargets )
2010-08-28 18:49:17 +02:00
include ( CheckPlatform )
2010-08-20 04:09:39 +02:00
2015-03-29 16:13:22 +02:00
include ( GroupSources )
2016-03-14 15:45:39 +01:00
include ( AutoCollect )
2015-03-29 16:13:22 +02:00
2010-08-20 04:09:39 +02:00
find_package ( PCHSupport )
2015-10-05 16:14:31 +02:00
find_package ( MySQL )
2013-05-21 08:36:52 +02:00
2013-02-11 23:27:20 +01:00
if ( NOT WITHOUT_GIT )
2013-02-11 20:04:27 +01:00
find_package ( Git )
endif ()
2010-10-03 16:55:24 +02:00
# Find revision ID and hash of the sourcetree
include ( cmake/genrev.cmake )
2010-08-28 21:51:28 +02:00
# print out the results before continuing
include ( cmake/showoptions.cmake )
2010-08-28 18:49:17 +02:00
# add dependencies
2010-08-17 02:14:20 +02:00
add_subdirectory ( dep )
2010-08-28 18:49:17 +02:00
# add core sources
2009-01-17 09:23:33 -05:00
add_subdirectory ( src )