azerothcore-wotlk2/CMakeLists.txt

143 lines
3.2 KiB
CMake
Raw Normal View History

# Copyright (C)
2016-06-26 10:39:44 +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.
2016-06-26 10:39:44 +02:00
#
# 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.
# Set projectname (must be done AFTER setting configurationtypes)
2016-07-10 17:14:06 +02:00
project(AzerothCore)
2016-06-26 10:39:44 +02:00
# CMake policies (can not be handled elsewhere)
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0005 OLD)
# add this options before PROJECT keyword
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
# 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)
2016-08-19 09:29:26 +02:00
set(AC_PATH_ROOT "${CMAKE_SOURCE_DIR}")
2016-06-26 10:39:44 +02:00
# set macro-directory
2017-12-21 00:48:33 +01:00
set(CMAKE_MODULE_PATH "${AC_PATH_ROOT}/src/cmake/macros")
2016-06-26 10:39:44 +02:00
include(CheckCXXSourceRuns)
include(CheckIncludeFiles)
# some utils for cmake
2017-10-13 19:22:30 +02:00
include(deps/drassil/cmake-utils/utils.cmake)
include(src/cmake/ac_macros.cmake)
2016-06-26 10:39:44 +02:00
# set default buildoptions and print them
include(conf/config.cmake.dist)
# load custom configurations for cmake if exists
2018-07-29 00:27:38 +08:00
if(EXISTS "${CMAKE_SOURCE_DIR}/conf/config.cmake")
include(conf/config.cmake)
endif()
#
# Loading dyn modules
#
# add modules and dependencies
CU_SUBDIRLIST(sub_DIRS "${CMAKE_SOURCE_DIR}/modules" FALSE FALSE)
FOREACH(subdir ${sub_DIRS})
get_filename_component(MODULENAME ${subdir} NAME)
if (";${DISABLED_AC_MODULES};" MATCHES ";${MODULENAME};")
continue()
endif()
STRING(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/" "" subdir_rel ${subdir})
if(EXISTS "${subdir}/CMakeLists.txt")
message("Loading module: ${subdir_rel}")
add_subdirectory("${subdir_rel}")
endif()
ENDFOREACH()
CU_RUN_HOOK("AFTER_LOAD_CONF")
# build in Release-mode by default if not explicitly set
if( NOT CMAKE_BUILD_TYPE )
set(CMAKE_BUILD_TYPE "Release")
endif()
2016-06-26 10:39:44 +02:00
# turn off PCH totally if enabled (hidden setting, mainly for devs)
if( NOPCH )
set(USE_COREPCH 0)
set(USE_SCRIPTPCH 0)
endif()
include(CheckPlatform)
include(GroupSources)
2016-06-26 10:39:44 +02:00
# basic packagesearching and setup (further support will be needed, this is a preliminary release!)
set(OPENSSL_EXPECTED_VERSION 1.0.0)
2016-08-10 12:39:25 +02:00
set(ACE_EXPECTED_VERSION 6.0.3)
2016-06-26 10:39:44 +02:00
find_package(PCHSupport)
find_package(ACE REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(MySQL REQUIRED)
2016-06-26 10:39:44 +02:00
if( UNIX )
find_package(Readline)
find_package(ZLIB)
find_package(BZip2)
if ( WITH_PERFTOOLS )
find_package(Gperftools)
endif()
2016-06-26 10:39:44 +02:00
endif()
2016-08-09 16:09:37 +02:00
if(NOT WITHOUT_GIT)
find_package(Git)
endif()
2016-06-26 10:39:44 +02:00
# Find revision ID and hash of the sourcetree
include(src/cmake/genrev.cmake)
2016-06-26 10:39:44 +02:00
# print out the results before continuing
include(src/cmake/showoptions.cmake)
2016-06-26 10:39:44 +02:00
2016-08-23 12:11:46 +02:00
#
# Loading framework
#
2017-10-13 19:22:30 +02:00
add_subdirectory(deps)
2016-08-23 12:11:46 +02:00
if( SERVERS OR TOOLS)
2017-12-21 00:48:33 +01:00
add_subdirectory(src/common)
2016-08-23 12:11:46 +02:00
endif()
if( TOOLS )
2017-10-13 19:22:30 +02:00
add_subdirectory(src/tools)
2016-08-23 12:11:46 +02:00
endif()
2016-08-23 12:11:46 +02:00
#
# Loading application sources
#
CU_RUN_HOOK("BEFORE_SRC_LOAD")
2016-06-26 10:39:44 +02:00
# add core sources
add_subdirectory(src)
CU_RUN_HOOK("AFTER_SRC_LOAD")