2020-01-02 06:44:10 +01:00
|
|
|
# This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
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.
|
|
|
|
|
|
2024-09-20 12:28:20 +02:00
|
|
|
cmake_minimum_required(VERSION 3.24)
|
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
|
|
|
|
2023-09-20 19:30:52 +02:00
|
|
|
if(POLICY CMP0144)
|
|
|
|
|
cmake_policy(SET CMP0144 NEW) # find_package() uses upper-case <PACKAGENAME>_ROOT variables
|
|
|
|
|
endif()
|
|
|
|
|
|
2024-03-01 11:36:10 +01:00
|
|
|
if(POLICY CMP0153)
|
|
|
|
|
cmake_policy(SET CMP0153 NEW) # The exec_program() command should not be called
|
|
|
|
|
endif()
|
|
|
|
|
|
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)
|
2023-05-20 13:57:57 +02:00
|
|
|
list(APPEND CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
2010-08-28 18:49:17 +02:00
|
|
|
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
|
2020-06-14 22:11:23 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/cmake/macros")
|
|
|
|
|
|
2010-08-28 18:49:17 +02:00
|
|
|
# build in Release-mode by default if not explicitly set
|
2020-04-16 17:53:36 +02:00
|
|
|
if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
|
|
|
|
|
set(CMAKE_DEFAULT_BUILD_TYPE "RelWithDebInfo" CACHE INTERNAL "")
|
|
|
|
|
endif()
|
|
|
|
|
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)
|
2020-06-22 15:27:03 +03:00
|
|
|
if(NOPCH)
|
2010-08-28 21:42:07 +02:00
|
|
|
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)
|
2013-05-21 08:36:52 +02:00
|
|
|
|
2013-02-11 23:27:20 +01:00
|
|
|
if(NOT WITHOUT_GIT)
|
2021-09-22 18:49:33 +02:00
|
|
|
find_package(Git 1.7)
|
2013-02-11 20:04:27 +01:00
|
|
|
endif()
|
|
|
|
|
|
2022-07-19 00:33:07 +02:00
|
|
|
# find mysql client binary (needed by genrev)
|
|
|
|
|
find_package(MySQL OPTIONAL_COMPONENTS binary)
|
|
|
|
|
|
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)
|
2020-07-22 20:27:54 +02:00
|
|
|
|
|
|
|
|
include(CTest)
|
|
|
|
|
if(BUILD_TESTING)
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH
|
|
|
|
|
"${Catch2_SOURCE_DIR}/contrib")
|
|
|
|
|
include(Catch)
|
|
|
|
|
|
|
|
|
|
add_subdirectory(tests)
|
2020-08-28 15:13:10 +02:00
|
|
|
|
|
|
|
|
# Catch cmakefile messes with our settings we explicitly leave up to the user
|
|
|
|
|
# restore user preference
|
|
|
|
|
if (NOT WITH_SOURCE_TREE STREQUAL "hierarchical-folders")
|
|
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
|
|
|
|
|
endif()
|
2020-07-22 20:27:54 +02:00
|
|
|
endif()
|