1 # Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
3 # This file is free software; as a special exception the author gives
4 # unlimited permission to copy and/or distribute it, with or without
5 # modifications, as long as this notice is preserved.
7 # This program is distributed in the hope that it will be useful, but
8 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
9 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # We require CMake >= 3.2
12 cmake_minimum_required(VERSION 3.2)
14 # add this options before PROJECT keyword
15 set(CMAKE_DISABLE_SOURCE_CHANGES ON)
16 set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
18 # Set projectname (must be done AFTER setting configurationtypes)
21 # CMake policies (can not be handled elsewhere)
22 cmake_policy(SET CMP0005 OLD)
24 cmake_policy(SET CMP0043 OLD) # Disable 'Ignore COMPILE_DEFINITIONS_<Config> properties'
28 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")
31 # Set RPATH-handing (CMake parameters)
32 set(CMAKE_SKIP_BUILD_RPATH 0)
33 set(CMAKE_BUILD_WITH_INSTALL_RPATH 0)
34 set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
35 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1)
38 list(APPEND CMAKE_MODULE_PATH
39 "${CMAKE_SOURCE_DIR}/cmake/macros"
40 "${CMAKE_SOURCE_DIR}/dep/cotire/CMake")
42 # build in Release-mode by default if not explicitly set
43 if( NOT CMAKE_BUILD_TYPE )
44 set(CMAKE_BUILD_TYPE "RelWithDebInfo")
47 include(CheckCXXSourceRuns)
48 include(CheckIncludeFiles)
49 include(ConfigureScripts)
51 # set default buildoptions and print them
52 include(cmake/options.cmake)
54 # turn off PCH totally if enabled (hidden setting, mainly for devs)
60 include(ConfigureBaseTargets)
61 include(CheckPlatform)
66 find_package(PCHSupport)
73 # Find revision ID and hash of the sourcetree
74 include(cmake/genrev.cmake)
76 # print out the results before continuing
77 include(cmake/showoptions.cmake)