summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-07-01 15:43:58 +0000
committerflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-07-01 15:43:58 +0000
commit0361920446e9311979b5187abf123ba8e055d944 (patch)
tree02d41953674d66ae58e0a5fae453f218b7934ae2
parent1c39635e7f5788b4777ee9f07d45b2228edeb899 (diff)
downloadhercules-0361920446e9311979b5187abf123ba8e055d944.tar.gz
hercules-0361920446e9311979b5187abf123ba8e055d944.tar.bz2
hercules-0361920446e9311979b5187abf123ba8e055d944.tar.xz
hercules-0361920446e9311979b5187abf123ba8e055d944.zip
* CMake: marked executables as different components and other miscellaneous changes. [FlavioJS]
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14877 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--3rdparty/CMakeLists.txt48
-rw-r--r--3rdparty/mysql/CMakeLists.txt66
-rw-r--r--3rdparty/pcre/CMakeLists.txt60
-rw-r--r--3rdparty/zlib/CMakeLists.txt60
-rw-r--r--CMakeLists.txt71
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/char/CMakeLists.txt8
-rw-r--r--src/char_sql/CMakeLists.txt8
-rw-r--r--src/login/CMakeLists.txt12
-rw-r--r--src/map/CMakeLists.txt14
-rw-r--r--src/tool/CMakeLists.txt4
11 files changed, 202 insertions, 151 deletions
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index 6e5c759cc..0ea359186 100644
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -1,4 +1,52 @@
+# macro to configure the use of local or system version of a package
+# Uses:
+# HAVE_LOCAL_${name} - is local version available?
+# ${name}_LOCAL_LIBRARIES - libraries of the local version
+# ${name}_LOCAL_INCLUDE_DIRS - include directories of the local version
+# HAVE_SYSTEM_${name} - is system version available?
+# ${name}_SYSTEM_LIBRARIES - libraries of the system version
+# ${name}_SYSTEM_INCLUDE_DIRS - include directories of the system version
+# Generates:
+# USE_LOCAL_${name} - use the local version of the package (only when local is available)
+# USE_${name} - use this package
+# ${name}_LIBRARIES - libraries
+# ${name}_INCLUDE_DIRS - include directories
+macro( CONFIGURE_USE_LOCAL_OR_SYSTEM name )
+ unset( ${name}_LIBRARIES CACHE )
+ unset( ${name}_INCLUDE_DIRS CACHE )
+ if( HAVE_LOCAL_${name} )
+ set( USE_LOCAL_${name} ON
+ CACHE BOOL "use local version of ${name}" )
+ else()
+ unset( USE_LOCAL_${name} CACHE )
+ endif()
+ if( USE_LOCAL_${name} )
+ message( STATUS "Configuring for local ${name}" )
+ set( ${name}_LIBRARIES ${${name}_LOCAL_LIBRARIES} )
+ set( ${name}_INCLUDE_DIRS ${${name}_LOCAL_INCLUDE_DIRS} )
+ message( STATUS "Configuring for local ${name} - done" )
+ elseif( HAVE_SYSTEM_${name} )
+ message( STATUS "Configuring for system ${name}" )
+ set( ${name}_LIBRARIES ${${name}_SYSTEM_LIBRARIES} )
+ set( ${name}_INCLUDE_DIRS ${${name}_SYSTEM_INCLUDE_DIRS} )
+ message( STATUS "Configuring for system ${name} - done" )
+ endif()
+ if( USE_LOCAL_${name} OR HAVE_SYSTEM_${name} )
+ set( USE_${name} ON
+ CACHE BOOL "use ${name}" )
+ else()
+ unset( USE_${name} CACHE )
+ endif()
+ set( ${name}_LIBRARIES ${${name}_LIBRARIES}
+ CACHE PATH "${name} libraries" )
+ set( ${name}_INCLUDE_DIRS ${${name}_INCLUDE_DIRS}
+ CACHE PATH "${name} include directories" )
+ mark_as_advanced( ${name}_LIBRARIES )
+ mark_as_advanced( ${name}_INCLUDE_DIRS )
+endmacro( CONFIGURE_USE_LOCAL_OR_SYSTEM )
+
+
add_subdirectory( msinttypes )
add_subdirectory( mt19937ar )
add_subdirectory( mysql )
diff --git a/3rdparty/mysql/CMakeLists.txt b/3rdparty/mysql/CMakeLists.txt
index 1c14d7395..902037f07 100644
--- a/3rdparty/mysql/CMakeLists.txt
+++ b/3rdparty/mysql/CMakeLists.txt
@@ -4,28 +4,28 @@
#
if( WIN32 )
message( STATUS "Detecting local MYSQL" )
-find_path( LOCAL_MYSQL_INCLUDE_DIRS "mysql.h"
+find_path( MYSQL_LOCAL_INCLUDE_DIRS "mysql.h"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
NO_DEFAULT_PATH )
-find_library( LOCAL_MYSQL_LIBRARIES
+find_library( MYSQL_LOCAL_LIBRARIES
NAMES libmysql
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib"
NO_DEFAULT_PATH )
-mark_as_advanced( LOCAL_MYSQL_LIBRARIES )
-mark_as_advanced( LOCAL_MYSQL_INCLUDE_DIRS )
+mark_as_advanced( MYSQL_LOCAL_LIBRARIES )
+mark_as_advanced( MYSQL_LOCAL_INCLUDE_DIRS )
-if( LOCAL_MYSQL_LIBRARIES AND LOCAL_MYSQL_INCLUDE_DIRS )
- if( EXISTS "${LOCAL_MYSQL_INCLUDE_DIRS}/mysql_version.h" )
- file( STRINGS "${LOCAL_MYSQL_INCLUDE_DIRS}/mysql_version.h" MYSQL_VERSION_H REGEX "^#define MYSQL_SERVER_VERSION[ \t]+\"[^\"]+\".*$" )
+if( MYSQL_LOCAL_LIBRARIES AND MYSQL_LOCAL_INCLUDE_DIRS )
+ if( EXISTS "${MYSQL_LOCAL_INCLUDE_DIRS}/mysql_version.h" )
+ file( STRINGS "${MYSQL_LOCAL_INCLUDE_DIRS}/mysql_version.h" MYSQL_VERSION_H REGEX "^#define MYSQL_SERVER_VERSION[ \t]+\"[^\"]+\".*$" )
string( REGEX REPLACE "^.*MYSQL_SERVER_VERSION[ \t]+\"([^\"]+)\".*$" "\\1" MYSQL_SERVER_VERSION "${MYSQL_VERSION_H}" )
- message( STATUS "Found MYSQL: ${LOCAL_MYSQL_LIBRARIES} (found version ${MYSQL_SERVER_VERSION})" )
+ message( STATUS "Found MYSQL: ${MYSQL_LOCAL_LIBRARIES} (found version ${MYSQL_SERVER_VERSION})" )
else()
- message( STATUS "Found MYSQL: ${LOCAL_MYSQL_LIBRARIES}" )
+ message( STATUS "Found MYSQL: ${MYSQL_LOCAL_LIBRARIES}" )
endif()
set( HAVE_LOCAL_MYSQL ON
CACHE BOOL "mysql client is available as a local copy")
else()
- foreach( _VAR LOCAL_MYSQL_LIBRARIES LOCAL_MYSQL_INCLUDE_DIRS )
+ foreach( _VAR MYSQL_LOCAL_LIBRARIES MYSQL_LOCAL_INCLUDE_DIRS )
if( NOT "${_VAR}" )
set( MISSING_VARS ${MISSING_VARS} ${_VAR} )
endif()
@@ -55,56 +55,26 @@ if( MYSQL_CONFIG_EXECUTABLE )
message( STATUS "Found MYSQL: ${MYSQL_LIBRARIES} (found version ${MYSQL_VERSION})" )
else()
# find mysql package
+ unset( MYSQL_LIBRARIES CACHE )
+ unset( MYSQL_INCLUDE_DIRS CACHE )
set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} )
find_package( MYSQL )
endif()
-set( SYSTEM_MYSQL_LIBRARIES "${MYSQL_LIBRARIES}"
+set( MYSQL_SYSTEM_LIBRARIES "${MYSQL_LIBRARIES}"
CACHE PATH "system mysql libraries" )
-set( SYSTEM_MYSQL_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}"
+set( MYSQL_SYSTEM_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}"
CACHE PATH "system mysql include directories" )
-mark_as_advanced( SYSTEM_MYSQL_LIBRARIES )
-mark_as_advanced( SYSTEM_MYSQL_INCLUDE_DIRS )
+mark_as_advanced( MYSQL_SYSTEM_LIBRARIES )
+mark_as_advanced( MYSQL_SYSTEM_INCLUDE_DIRS )
-if( SYSTEM_MYSQL_LIBRARIES AND SYSTEM_MYSQL_INCLUDE_DIRS )
+if( MYSQL_SYSTEM_LIBRARIES AND MYSQL_SYSTEM_INCLUDE_DIRS )
set( HAVE_SYSTEM_MYSQL ON
CACHE BOOL "mysql client is available on the system" )
endif()
message( STATUS "Detecting system MYSQL - done" )
-# options
-
#
# configure
#
-unset( MYSQL_LIBRARIES CACHE )
-unset( MYSQL_INCLUDE_DIRS CACHE )
-if( HAVE_LOCAL_MYSQL )
- set( USE_LOCAL_MYSQL ON
- CACHE BOOL "use local copy of mysql" )
-else()
- unset( USE_LOCAL_MYSQL CACHE )
-endif()
-if( USE_LOCAL_MYSQL )
- message( STATUS "Configuring for local MYSQL" )
- set( MYSQL_LIBRARIES ${LOCAL_MYSQL_LIBRARIES} )
- set( MYSQL_INCLUDE_DIRS ${LOCAL_MYSQL_INCLUDE_DIRS} )
- message( STATUS "Configuring for local MYSQL - done" )
-elseif( HAVE_SYSTEM_MYSQL )
- message( STATUS "Configuring for system MYSQL" )
- set( MYSQL_LIBRARIES ${SYSTEM_MYSQL_LIBRARIES} )
- set( MYSQL_INCLUDE_DIRS ${SYSTEM_MYSQL_INCLUDE_DIRS} )
- message( STATUS "Configuring for system MYSQL - done" )
-endif()
-if( USE_LOCAL_MYSQL OR HAVE_SYSTEM_MYSQL )
- set( USE_MYSQL ON
- CACHE BOOL "use mysql" )
-else()
- unset( USE_MYSQL CACHE )
-endif()
-set( MYSQL_LIBRARIES ${MYSQL_LIBRARIES}
- CACHE PATH "mysql libraries" )
-set( MYSQL_INCLUDE_DIRS ${MYSQL_INCLUDE_DIRS}
- CACHE PATH "mysql include directories" )
-mark_as_advanced( MYSQL_LIBRARIES )
-mark_as_advanced( MYSQL_INCLUDE_DIRS )
+CONFIGURE_USE_LOCAL_OR_SYSTEM( MYSQL )
diff --git a/3rdparty/pcre/CMakeLists.txt b/3rdparty/pcre/CMakeLists.txt
index 0625999b1..ab1c83b6d 100644
--- a/3rdparty/pcre/CMakeLists.txt
+++ b/3rdparty/pcre/CMakeLists.txt
@@ -4,25 +4,25 @@
#
if( WIN32 )
message( STATUS "Detecting local PCRE" )
-find_path( LOCAL_PCRE_INCLUDE_DIRS "pcre.h"
+find_path( PCRE_LOCAL_INCLUDE_DIRS "pcre.h"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
NO_DEFAULT_PATH )
-find_library( LOCAL_PCRE_LIBRARIES
+find_library( PCRE_LOCAL_LIBRARIES
NAMES pcre
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib"
NO_DEFAULT_PATH )
-mark_as_advanced( LOCAL_PCRE_LIBRARIES )
-mark_as_advanced( LOCAL_PCRE_INCLUDE_DIRS )
+mark_as_advanced( PCRE_LOCAL_LIBRARIES )
+mark_as_advanced( PCRE_LOCAL_INCLUDE_DIRS )
-if( LOCAL_PCRE_LIBRARIES AND LOCAL_PCRE_INCLUDE_DIRS )
- file( STRINGS "${LOCAL_PCRE_INCLUDE_DIRS}/pcre.h" PCRE_H REGEX "^#define[ \t]+PCRE_M[A-Z]+[ \t]+[0-9]+.*$" )
+if( PCRE_LOCAL_LIBRARIES AND PCRE_LOCAL_INCLUDE_DIRS )
+ file( STRINGS "${PCRE_LOCAL_INCLUDE_DIRS}/pcre.h" PCRE_H REGEX "^#define[ \t]+PCRE_M[A-Z]+[ \t]+[0-9]+.*$" )
string( REGEX REPLACE "^.*PCRE_MAJOR[ \t]+([0-9]+).*$" "\\1" PCRE_MAJOR "${PCRE_H}" )
string( REGEX REPLACE "^.*PCRE_MINOR[ \t]+([0-9]+).*$" "\\1" PCRE_MINOR "${PCRE_H}" )
- message( STATUS "Found PCRE: ${LOCAL_PCRE_LIBRARIES} (found version ${PCRE_MAJOR}.${PCRE_MINOR})" )
+ message( STATUS "Found PCRE: ${PCRE_LOCAL_LIBRARIES} (found version ${PCRE_MAJOR}.${PCRE_MINOR})" )
set( HAVE_LOCAL_PCRE ON
CACHE BOOL "pcre is available as a local copy" )
else()
- foreach( _VAR LOCAL_PCRE_LIBRARIES LOCAL_PCRE_INCLUDE_DIRS )
+ foreach( _VAR PCRE_LOCAL_LIBRARIES PCRE_LOCAL_INCLUDE_DIRS )
if( NOT "${_VAR}" )
set( MISSING_VARS ${MISSING_VARS} ${_VAR} )
endif()
@@ -39,15 +39,17 @@ endif( WIN32 )
#
message( STATUS "Detecting system PCRE" )
set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} )
+unset( PCRE_LIBRARIES CACHE )
+unset( PCRE_INCLUDE_DIRS CACHE )
find_package( PCRE )
-set( SYSTEM_PCRE_LIBRARIES ${PCRE_LIBRARIES}
+set( PCRE_SYSTEM_LIBRARIES ${PCRE_LIBRARIES}
CACHE PATH "system pcre libraries" )
-set( SYSTEM_PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS}
+set( PCRE_SYSTEM_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS}
CACHE PATH "system pcre include directories" )
-mark_as_advanced( SYSTEM_PCRE_LIBRARIES )
-mark_as_advanced( SYSTEM_PCRE_INCLUDE_DIRS )
+mark_as_advanced( PCRE_SYSTEM_LIBRARIES )
+mark_as_advanced( PCRE_SYSTEM_INCLUDE_DIRS )
-if( SYSTEM_PCRE_LIBRARIES AND SYSTEM_PCRE_INCLUDE_DIRS )
+if( PCRE_SYSTEM_LIBRARIES AND PCRE_SYSTEM_INCLUDE_DIRS )
set( HAVE_SYSTEM_PCRE ON
CACHE BOOL "pcre is available on the system" )
else()
@@ -59,34 +61,4 @@ message( STATUS "Detecting system PCRE - done" )
#
# configure
#
-unset( PCRE_LIBRARIES CACHE )
-unset( PCRE_INCLUDE_DIRS CACHE )
-if( HAVE_LOCAL_PCRE )
- set( USE_LOCAL_PCRE ON
- CACHE BOOL "use local copy of pcre" )
-else()
- unset( USE_LOCAL_PCRE CACHE )
-endif()
-if( USE_LOCAL_PCRE )
- message( STATUS "Configuring for local PCRE" )
- set( PCRE_LIBRARIES ${LOCAL_PCRE_LIBRARIES} )
- set( PCRE_INCLUDE_DIRS ${LOCAL_PCRE_INCLUDE_DIRS} )
- message( STATUS "Configuring for local PCRE - done" )
-elseif( HAVE_SYSTEM_PCRE )
- message( STATUS "Configuring for system PCRE" )
- set( PCRE_LIBRARIES ${SYSTEM_PCRE_LIBRARIES} )
- set( PCRE_INCLUDE_DIRS ${SYSTEM_PCRE_INCLUDE_DIRS} )
- message( STATUS "Configuring for system PCRE - done" )
-endif()
-if( USE_LOCAL_PCRE OR HAVE_SYSTEM_PCRE )
- set( USE_PCRE ON
- CACHE BOOL "use pcre" )
-else()
- unset( USE_PCRE CACHE )
-endif()
-set( PCRE_LIBRARIES ${PCRE_LIBRARIES}
- CACHE PATH "pcre libraries" )
-set( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS}
- CACHE PATH "pcre include directories" )
-mark_as_advanced( PCRE_LIBRARIES )
-mark_as_advanced( PCRE_INCLUDE_DIRS )
+CONFIGURE_USE_LOCAL_OR_SYSTEM( PCRE )
diff --git a/3rdparty/zlib/CMakeLists.txt b/3rdparty/zlib/CMakeLists.txt
index 849813be0..3bb4304e7 100644
--- a/3rdparty/zlib/CMakeLists.txt
+++ b/3rdparty/zlib/CMakeLists.txt
@@ -4,24 +4,24 @@
#
if( WIN32 )
message( STATUS "Detecting local ZLIB" )
-find_path( LOCAL_ZLIB_INCLUDE_DIRS "zlib.h"
+find_path( ZLIB_LOCAL_INCLUDE_DIRS "zlib.h"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
NO_DEFAULT_PATH )
-find_library( LOCAL_ZLIB_LIBRARIES
+find_library( ZLIB_LOCAL_LIBRARIES
NAMES zdll
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib"
NO_DEFAULT_PATH )
-mark_as_advanced( LOCAL_ZLIB_LIBRARIES )
-mark_as_advanced( LOCAL_ZLIB_INCLUDE_DIRS )
+mark_as_advanced( ZLIB_LOCAL_LIBRARIES )
+mark_as_advanced( ZLIB_LOCAL_INCLUDE_DIRS )
-if( LOCAL_ZLIB_LIBRARIES AND LOCAL_ZLIB_INCLUDE_DIRS )
- file( STRINGS "${LOCAL_ZLIB_INCLUDE_DIRS}/zlib.h" ZLIB_H REGEX "^#define[ \t]+ZLIB_VERSION[ \t]+\"[^\"]+\".*$" )
+if( ZLIB_LOCAL_LIBRARIES AND ZLIB_LOCAL_INCLUDE_DIRS )
+ file( STRINGS "${ZLIB_LOCAL_INCLUDE_DIRS}/zlib.h" ZLIB_H REGEX "^#define[ \t]+ZLIB_VERSION[ \t]+\"[^\"]+\".*$" )
string( REGEX REPLACE "^.*ZLIB_VERSION[ \t]+\"([^\"]+)\".*$" "\\1" ZLIB_VERSION "${ZLIB_H}" )
- message( STATUS "Found local ZLIB: ${LOCAL_ZLIB_LIBRARIES} (found version ${ZLIB_VERSION})" )
+ message( STATUS "Found local ZLIB: ${ZLIB_LOCAL_LIBRARIES} (found version ${ZLIB_VERSION})" )
set( HAVE_LOCAL_ZLIB ON
CACHE BOOL "zlib is available as a local copy" )
else()
- foreach( _VAR LOCAL_ZLIB_LIBRARIES LOCAL_ZLIB_INCLUDE_DIRS )
+ foreach( _VAR ZLIB_LOCAL_LIBRARIES ZLIB_LOCAL_INCLUDE_DIRS )
if( NOT "${_VAR}" )
set( MISSING_VARS ${MISSING_VARS} ${_VAR} )
endif()
@@ -37,15 +37,17 @@ endif( WIN32 )
# system
#
message( STATUS "Detecting system ZLIB" )
+unset( ZLIB_LIBRARIES CACHE )
+unset( ZLIB_INCLUDE_DIRS CACHE )
find_package( ZLIB )
-set( SYSTEM_ZLIB_LIBRARIES ${ZLIB_LIBRARIES}
+set( ZLIB_SYSTEM_LIBRARIES ${ZLIB_LIBRARIES}
CACHE PATH "system zlib libraries" )
-set( SYSTEM_ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}
+set( ZLIB_SYSTEM_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}
CACHE PATH "system zlib include directories" )
-mark_as_advanced( SYSTEM_ZLIB_LIBRARIES )
-mark_as_advanced( SYSTEM_ZLIB_INCLUDE_DIRS )
+mark_as_advanced( ZLIB_SYSTEM_LIBRARIES )
+mark_as_advanced( ZLIB_SYSTEM_INCLUDE_DIRS )
-if( SYSTEM_ZLIB_LIBRARIES AND SYSTEM_ZLIB_INCLUDE_DIRS )
+if( ZLIB_SYSTEM_LIBRARIES AND ZLIB_SYSTEM_INCLUDE_DIRS )
set( HAVE_SYSTEM_ZLIB ON
CACHE BOOL "zlib is available on the system" )
else()
@@ -57,34 +59,4 @@ message( STATUS "Detecting system ZLIB - done" )
#
# configure
#
-unset( ZLIB_LIBRARIES CACHE )
-unset( ZLIB_INCLUDE_DIRS CACHE )
-if( HAVE_LOCAL_ZLIB )
- set( USE_LOCAL_ZLIB ON
- CACHE BOOL "use local copy of zlib" )
-else()
- unset( USE_LOCAL_ZLIB CACHE )
-endif()
-if( USE_LOCAL_ZLIB )
- message( STATUS "Configuring for local ZLIB" )
- set( ZLIB_LIBRARIES ${LOCAL_ZLIB_LIBRARIES} )
- set( ZLIB_INCLUDE_DIRS ${LOCAL_ZLIB_INCLUDE_DIRS} )
- message( STATUS "Configuring for local ZLIB - done" )
-elseif( HAVE_SYSTEM_ZLIB )
- message( STATUS "Configuring for system ZLIB" )
- set( ZLIB_LIBRARIES ${SYSTEM_ZLIB_LIBRARIES} )
- set( ZLIB_INCLUDE_DIRS ${SYSTEM_ZLIB_INCLUDE_DIRS} )
- message( STATUS "Configuring for system ZLIB - done" )
-endif()
-if( USE_LOCAL_ZLIB OR HAVE_SYSTEM_ZLIB )
- set( USE_ZLIB ON
- CACHE BOOL "use zlib" )
-else()
- unset( USE_ZLIB CACHE )
-endif()
-set( ZLIB_LIBRARIES ${ZLIB_LIBRARIES}
- CACHE PATH "zlib libraries" )
-set( ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}
- CACHE PATH "zlib include directories" )
-mark_as_advanced( ZLIB_LIBRARIES )
-mark_as_advanced( ZLIB_INCLUDE_DIRS )
+CONFIGURE_USE_LOCAL_OR_SYSTEM( ZLIB )
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f7c46987..a56059956 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,10 @@
-
+# "Getting Started with CMake", a tutorial video by Eric Wing.
+# Part 1 of 6: http://www.youtube.com/watch?v=CLvZTyji_Uw
+# Part 2 of 6: http://www.youtube.com/watch?v=gUW-RrRQjEg
+# Part 3 of 6: http://www.youtube.com/watch?v=sz6cPhbuTk4
+# Part 4 of 6: http://www.youtube.com/watch?v=JICZOkyNXbg
+# Part 5 of 6: http://www.youtube.com/watch?v=lAiuLHy4dCk
+# Part 6 of 6: http://www.youtube.com/watch?v=fAtJNzDZdH8
cmake_minimum_required( VERSION 2.8.4 )
project( eAthena )
@@ -165,13 +171,43 @@ endif()
set( PACKETVER ""
CACHE STRING "Sets the PACKETVER define of the servers. (see src/common/mmo.h)" )
+
+#####################################################################
+# package stuff
+#
+if( OFF )
+set( CPACK_PACKAGE_NAME "eAthena" )
+set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "MMORPG server package" )
+set( CPACK_PACKAGE_FILE_NAME )
+set( CPACK_PACKAGE_INSTALL_DIRECTORY )
+set( CPACK_PROJECT_CONFIG_FILE )
+set( CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE )
+set( CPACK_RESOURCE_FILE_README )
+set( CPACK_RESOURCE_FILE_WELCOME )
+set( CPACK_MONOLITHIC_INSTALL ON )
+set( CPACK_GENERATOR "ZIP" )
+set( CPACK_OUTPUT_CONFIG_FILE )
+set( CPACK_PACKAGE_EXECUTABLES )
+set( CPACK_STRIP_FILES )
+#source
+set( CPACK_SOURCE_PACKAGE_FILE_NAME )
+set( CPACK_SOURCE_STRIP_FILES )
+set( CPACK_SOURCE_GENERATOR "ZIP" )
+set( CPACK_SOURCE_OUTPUT_CONFIG_FILE )
+set( CPACK_SOURCE_IGNORE_FILES )
+include(CPACK)
+endif()
+
+
#
# install stuff
#
+set( COMPONENT_SOURCE "Source code, librarires and project files" CACHE INTERNAL "" )
+set( COMPONENT_BASE "Base files" CACHE INTERNAL "" )
option( INSTALL_RUN_DATA "install files needed to run the project" ON )
option( INSTALL_BUILD_DATA "install files needed to build the project" OFF )
set( SVN_FOLDER_PATTERN "[\\.]svn"
- CACHE PATH "pattern of svn folder that we exclude from instalations" )
+ CACHE STRING "pattern of svn folder that we exclude from instalations" )
mark_as_advanced( SVN_FOLDER_PATTERN )
if( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}" )
set( INSTALLING_TO_SOURCE ON
@@ -252,18 +288,37 @@ function( INSTALL_DIRECTORIES DIRS EXCLUDE_PATTERN )
endforeach()
endfunction()
if( NOT INSTALLING_TO_SOURCE )
+ # skipped if in-source
if( INSTALL_RUN_DATA )
- install( FILES ${LOCAL_RUN_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX} )
- INSTALL_DIRECTORIES( "${LOCAL_RUN_DIRECTORIES}" "conf/import-tmpl" )
+ # base
+ install( FILES ${LOCAL_RUN_FILES}
+ DESTINATION ${CMAKE_INSTALL_PREFIX} )
+ foreach( DIR IN ITEMS ${LOCAL_RUN_DIRECTORIES} )
+ install( DIRECTORY "${DIR}/"
+ DESTINATION "${DIR}"
+ PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE
+ PATTERN "conf/import-tmpl" EXCLUDE )
+ endforeach()
endif()
if( INSTALL_BUILD_DATA )
- install( FILES ${LOCAL_BUILD_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX} )
- INSTALL_DIRECTORIES( "${LOCAL_BUILD_DIRECTORIES}" "" )
+ # source
+ install( FILES ${LOCAL_BUILD_FILES}
+ DESTINATION ${CMAKE_INSTALL_PREFIX} )
+ foreach( DIR IN ITEMS ${LOCAL_BUILD_DIRECTORIES} )
+ install( DIRECTORY "${DIR}/"
+ DESTINATION "${DIR}"
+ PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE )
+ endforeach()
endif()
endif()
if( INSTALL_RUN_DATA )
- INSTALL_DIRECTORY( "save-tmpl" "save" "" )
- INSTALL_DIRECTORY( "conf/import-tmpl" "conf/import" "" )
+ # base templates
+ install( DIRECTORY "save-tmpl/"
+ DESTINATION "save"
+ PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE )
+ install( DIRECTORY "conf/import-tmpl/"
+ DESTINATION "conf/import"
+ PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE )
endif()
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index cc0b1d7ef..f8b235416 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -1,5 +1,7 @@
Date Added
+2011/07/01
+ * CMake: marked executables as different components and other miscellaneous changes. [FlavioJS]
2011/06/29
* Added experimental support for CMake. (for now: basic build, no extras, only tested with VS10 and cygwin) [FlavioJS]
2011/06/27
diff --git a/src/char/CMakeLists.txt b/src/char/CMakeLists.txt
index 666070532..5c2d66c3c 100644
--- a/src/char/CMakeLists.txt
+++ b/src/char/CMakeLists.txt
@@ -1,5 +1,7 @@
+#
# setup
+#
set( MT19937AR_SOURCES
# "${MT19937AR_SOURCE_DIR}/mt19937ar.c"
)
@@ -33,7 +35,9 @@ set( CHAR_SOURCES
)
+#
# char txt
+#
if( USE_ZLIB )
message ( STATUS "Creating target char-server" )
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} )
@@ -56,7 +60,9 @@ add_executable( char-server ${SOURCE_FILES} )
target_link_libraries( char-server ${LIBRARIES} )
set_target_properties( char-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
- install( TARGETS char-server DESTINATION ${CMAKE_INSTALL_PREFIX} )
+ install( TARGETS char-server
+ DESTINATION ${CMAKE_INSTALL_PREFIX}
+ COMPONENT "char-server" )
endif()
message ( STATUS "Creating target char-server - done" )
else()
diff --git a/src/char_sql/CMakeLists.txt b/src/char_sql/CMakeLists.txt
index d534ce89c..412393b21 100644
--- a/src/char_sql/CMakeLists.txt
+++ b/src/char_sql/CMakeLists.txt
@@ -1,5 +1,7 @@
+#
# setup
+#
set( MT19937AR_SOURCES
# "${MT19937AR_SOURCE_DIR}/mt19937ar.c"
)
@@ -37,7 +39,9 @@ set( CHAR_SOURCES
)
+#
# char sql
+#
if( USE_ZLIB AND USE_MYSQL )
message ( STATUS "Creating target char-server_sql" )
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ${MYSQL_LIBRARIES} )
@@ -60,7 +64,9 @@ add_executable( char-server_sql ${SOURCE_FILES} )
target_link_libraries( char-server_sql ${LIBRARIES} )
set_target_properties( char-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
- install( TARGETS char-server_sql DESTINATION ${CMAKE_INSTALL_PREFIX} )
+ install( TARGETS char-server_sql
+ DESTINATION ${CMAKE_INSTALL_PREFIX}
+ COMPONENT "char-server_sql" )
endif()
message ( STATUS "Creating target char-server_sql - done" )
else()
diff --git a/src/login/CMakeLists.txt b/src/login/CMakeLists.txt
index 88d137507..b75878eed 100644
--- a/src/login/CMakeLists.txt
+++ b/src/login/CMakeLists.txt
@@ -1,5 +1,7 @@
+#
# setup
+#
set( MT19937AR_SOURCES
"${MT19937AR_SOURCE_DIR}/mt19937ar.c"
)
@@ -64,7 +66,9 @@ add_executable( login-server ${SOURCE_FILES} )
target_link_libraries( login-server ${LIBRARIES} )
set_target_properties( login-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
- install( TARGETS login-server DESTINATION ${CMAKE_INSTALL_PREFIX} )
+ install( TARGETS login-server
+ DESTINATION ${CMAKE_INSTALL_PREFIX}
+ COMPONENT "login-server" )
endif()
message ( STATUS "Creating target login-server - done" )
else()
@@ -72,7 +76,9 @@ message ( STATUS "Skipping target login-server (requires ZLIB)" )
endif()
+#
# login sql
+#
if( USE_ZLIB AND USE_MYSQL )
message ( STATUS "Creating target login-server_sql" )
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ${MYSQL_LIBRARIES} )
@@ -95,7 +101,9 @@ add_executable( login-server_sql ${SOURCE_FILES} )
target_link_libraries( login-server_sql ${LIBRARIES} )
set_target_properties( login-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
- install( TARGETS login-server_sql DESTINATION ${CMAKE_INSTALL_PREFIX} )
+ install( TARGETS login-server_sql
+ DESTINATION ${CMAKE_INSTALL_PREFIX}
+ COMPONENT "login-server_sql" )
endif()
message ( STATUS "Creating target login-server_sql - done" )
else()
diff --git a/src/map/CMakeLists.txt b/src/map/CMakeLists.txt
index e5589a30e..7189bbdd7 100644
--- a/src/map/CMakeLists.txt
+++ b/src/map/CMakeLists.txt
@@ -1,5 +1,7 @@
+#
# setup
+#
set( MT19937AR_SOURCES
"${MT19937AR_SOURCE_DIR}/mt19937ar.c"
)
@@ -68,7 +70,9 @@ set( MAP_SQL_SOURCES
)
+#
# map txt
+#
if( USE_ZLIB )
message ( STATUS "Creating target map-server" )
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} )
@@ -96,7 +100,9 @@ add_executable( map-server ${SOURCE_FILES} )
target_link_libraries( map-server ${LIBRARIES} )
set_target_properties( map-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
- install( TARGETS map-server DESTINATION ${CMAKE_INSTALL_PREFIX} )
+ install( TARGETS map-server
+ DESTINATION ${CMAKE_INSTALL_PREFIX}
+ COMPONENT "map-server" )
endif()
message ( STATUS "Creating target map-server - done" )
else()
@@ -104,7 +110,9 @@ message ( STATUS "Skipping target map-server (requires ZLIB; optional PCRE)" )
endif()
+#
# map sql
+#
if( USE_ZLIB AND USE_MYSQL )
message ( STATUS "Creating target map-server_sql" )
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ${MYSQL_LIBRARIES} )
@@ -132,7 +140,9 @@ add_executable( map-server_sql ${SOURCE_FILES} )
target_link_libraries( map-server_sql ${LIBRARIES} )
set_target_properties( map-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
- install( TARGETS map-server_sql DESTINATION ${CMAKE_INSTALL_PREFIX} )
+ install( TARGETS map-server_sql
+ DESTINATION ${CMAKE_INSTALL_PREFIX}
+ COMPONENT "map-server_sql" )
endif()
message ( STATUS "Creating target map-server_sql - done" )
else()
diff --git a/src/tool/CMakeLists.txt b/src/tool/CMakeLists.txt
index 5b4880893..4f69174b9 100644
--- a/src/tool/CMakeLists.txt
+++ b/src/tool/CMakeLists.txt
@@ -41,7 +41,9 @@ include_directories( ${INCLUDE_DIRS} )
target_link_libraries( mapcache ${ZLIB_LIBRARIES} )
set_target_properties( mapcache PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
- install( TARGETS mapcache DESTINATION ${CMAKE_INSTALL_PREFIX} )
+ install( TARGETS mapcache
+ DESTINATION ${CMAKE_INSTALL_PREFIX}
+ COMPONENT "mapcache" )
endif()
message ( STATUS "Creating target mapcache - done" )
else()