summaryrefslogtreecommitdiff
path: root/3rdparty
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 /3rdparty
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
Diffstat (limited to '3rdparty')
-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
4 files changed, 98 insertions, 136 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 )