Temporary fix linux build (back to cmake 2.6.0 standards untill a better solution is found)

+ clean up the base cmakelists.txt a bit
+ remove a GCC-warning when attempting build from a CMake-generated VS-project/solution

--HG--
branch : trunk
This commit is contained in:
click
2010-06-24 15:08:01 +02:00
parent a5a2676e88
commit 35aa050db8
2 changed files with 77 additions and 82 deletions

View File

@@ -9,14 +9,21 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
project(Trinity)
# CMake policies
cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0005 OLD)
# Force out-of-source build
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" BUILDING_IN_SOURCE)
if(BUILDING_IN_SOURCE)
message(FATAL_ERROR "This project requires an out of source build. Remove the file 'CMakeCache.txt' found in this directory before continuing, and create a separate build directory and run 'cmake path_to_project [options]' from there.")
endif(BUILDING_IN_SOURCE)
if( BUILDING_IN_SOURCE )
message(FATAL_ERROR "
This project requires an out of source build. Remove the file 'CMakeCache.txt'
found in this directory before continuing, create a separate build directory
and run 'cmake path_to_project [options]' from there.
")
endif()
#
# Basic packagesearching and setup (further support will be needed, this is a preliminary release!)
@@ -32,22 +39,23 @@ include(cmake/FindOpenSSL.cmake)
# *nix-specific packages ( zlib and bzip2 libraries will be built from sourcetree on WIN32-platforms)
#
if(UNIX)
include(cmake/FindReadline.cmake)
include(cmake/FindTermcap.cmake)
include(FindZLIB)
include(FindBZip2)
endif(UNIX)
if( UNIX )
include(cmake/FindReadline.cmake)
include(cmake/FindTermcap.cmake)
include(FindZLIB)
include(FindBZip2)
endif()
# Select the Release build configuration by default.
if(NOT CMAKE_BUILD_TYPE)
if( NOT CMAKE_BUILD_TYPE )
set(CMAKE_BUILD_TYPE "Release")
endif(NOT CMAKE_BUILD_TYPE)
endif()
CONFIGURE_FILE(
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
IMMEDIATE @ONLY
)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@@ -62,25 +70,22 @@ option(DO_RA "With RA" 0)
option(DO_SCRIPTS "With trinityscripts" 1)
option(DO_SQL "Copy SQL files" 0)
option(DO_TOOLS "Build tools" 0)
if( UNIX )
option(CENTOS "CENTOS" 0)
option(DO_WARN "Enable all compile warnings" 0)
endif( UNIX )
if( UNIX )
if( CENTOS )
add_definitions(-DCENTOS)
find_termcap()
else( CENTOS )
else()
find_readline()
endif( CENTOS )
endif( UNIX )
endif()
endif()
# Set up the installation-prefix
if( PREFIX )
set(CMAKE_INSTALL_PREFIX ${PREFIX})
endif( PREFIX )
endif()
set(GENREV_SRC
src/genrevision/genrevision.cpp
@@ -89,7 +94,6 @@ set(GENREV_SRC
# Handle debugmode compiles (this will require further work for proper WIN32-setups)
if( DO_DEBUG )
set(CMAKE_BUILD_TYPE Debug)
add_executable(genrev
${GENREV_SRC}
)
@@ -97,11 +101,10 @@ if( DO_DEBUG )
add_custom_target("revision.h" ALL
COMMAND "${CMAKE_BINARY_DIR}/genrev"
${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/src/server/shared"
WORKING_DIRECTORY "${CMAKE_BUILD_DIR}"
DEPENDS genrev
)
else ( DO_DEBUG )
else()
add_executable(genrev
${GENREV_SRC}
)
@@ -109,11 +112,10 @@ else ( DO_DEBUG )
add_custom_target("revision.h" ALL
COMMAND "${CMAKE_BINARY_DIR}/genrev"
${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/src/server/shared"
WORKING_DIRECTORY "${CMAKE_BUILD_DIR}"
DEPENDS genrev
)
endif( DO_DEBUG )
endif()
execute_process(
COMMAND hg tip --template {rev}
@@ -126,10 +128,9 @@ message("* TrinityCore revision : ${HG_REVISION}")
message("* Build binaries in : ${CMAKE_BUILD_TYPE} mode")
message("")
if( CONF_DIR )
else( CONF_DIR )
if( NOT CONF_DIR )
set(CONF_DIR ${CMAKE_INSTALL_PREFIX}/etc)
endif( CONF_DIR )
endif()
set(LIBSDIR ${CMAKE_INSTALL_PREFIX}/lib)
@@ -140,83 +141,86 @@ message("")
if( DO_AUTHSERVER )
message("* Build authserver : Yes (default)")
else( DO_AUTHSERVER )
else()
message("* Build authserver : No")
endif( DO_AUTHSERVER )
endif()
if( DO_WORLDSERVER )
message("* Build worldserver : Yes (default)")
else( DO_WORLDSERVER )
else()
message("* Build worldserver : No")
endif( DO_WORLDSERVER )
endif()
if( DO_SCRIPTS )
message("* Build Trinityscripts : Yes (default)")
add_definitions(-DDO_SCRIPTS)
else( DO_SCRIPTS )
else()
message("* Build Trinityscripts : No")
endif( DO_SCRIPTS )
endif()
if( DO_TOOLS )
message("* Build map/vmap tools : Yes")
else( DO_TOOLS )
else()
message("* Build map/vmap tools : No (default)")
endif( DO_TOOLS )
endif()
if(DO_CLI)
if( DO_CLI )
message("* Build with CLI : Yes (default)")
add_definitions(-DENABLE_CLI)
else(DO_CLI)
else()
message("* Build with CLI : No")
endif(DO_CLI)
endif()
if(DO_RA)
if( DO_RA )
message("* Build with RA : Yes")
add_definitions(-DENABLE_RA)
else(DO_RA)
else()
message("* Build with RA : No (default)")
endif(DO_RA)
endif()
if( DO_DEBUG )
message("* Build in debug-mode : Yes")
add_definitions(-g -DTRINITY_DEBUG)
else( DO_DEBUG )
else()
message("* Build in debug-mode : No (default)")
add_definitions(--no-warnings) # makes build look nice, no warnings shown at all, only errors
endif( DO_DEBUG )
endif()
if( DO_PCH )
message("* Use PCH : Yes (default)")
else( DO_PCH )
else()
message("* Use PCH : No")
endif( DO_PCH )
endif()
if( UNIX )
if( DO_WARN )
message("* Show all warnings : Yes")
if( DO_WARN )
message("* Show all warnings : Yes")
if( UNIX )
add_definitions(-Wall -Wfatal-errors -Wextra)
else( DO_WARN )
message("* Show compile-warnings : No (default)")
endif()
else()
message("* Show compile-warnings : No (default)")
if( UNIX )
add_definitions(--no-warnings) # makes build look nice, no warnings shown at all, only errors
endif( DO_WARN )
endif( UNIX )
elseif( WIN32 )
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
endif()
if(DO_SQL)
if( DO_SQL )
message("* Install SQL-files : Yes")
else (DO_SQL)
else()
message("* Install SQL-files : No (default)")
endif(DO_SQL)
endif()
message("")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
# Little tweak for OS X
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
if( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
set(MACOSX 1)
set(OSX_LIBS /opt/local/lib/libcrypto.dylib)
add_definitions(-D__ASSERTMACROS__)
endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
endif()
set(CMAKE_SKIP_BUILD_RPATH 0)
set(CMAKE_BUILD_WITH_INSTALL_RPATH 0)
@@ -225,6 +229,6 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1)
add_subdirectory(externals)
add_subdirectory(src)
if(DO_SQL)
add_subdirectory(sql)
endif(DO_SQL)
if( DO_SQL )
add_subdirectory(sql)
endif()

View File

@@ -24,12 +24,9 @@ else( OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES )
/usr/local/include
/usr/local/include/openssl
/usr/local/openssl/include
if (CMAKE_CL_64)
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;InstallLocation]/include/openssl"
else
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/include/openssl"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/include/openssl"
endif
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;InstallLocation]/include/openssl"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/include/openssl"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/include/openssl"
DOC
"Specify the directory containing openssl.h."
)
@@ -44,12 +41,9 @@ else( OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES )
/usr/local/lib
/usr/local/lib/ssl
/usr/local/ssl/lib
if (CMAKE_CL_64)
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;InstallLocation]/lib"
else
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/lib"
endif
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;InstallLocation]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/lib"
DOC "Specify the OpenSSL library here."
)
@@ -58,12 +52,9 @@ else( OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES )
NAMES
libeay32
PATHS
if (CMAKE_CL_64)
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;InstallLocation]/lib"
else
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/lib"
endif
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;InstallLocation]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]/lib"
DOC
"if more libraries are necessary to link in a OpenSSL client, specify them here."
)