summaryrefslogtreecommitdiff
path: root/3rdparty/zlib
diff options
context:
space:
mode:
authorflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-06-29 12:26:51 +0000
committerflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-06-29 12:26:51 +0000
commitdd73c6ea546a8828653cdce38a52f575cbdd3b96 (patch)
tree7c388def15aaf5e09e73f563ffa39c72d7c28c2f /3rdparty/zlib
parenta9492cf82f696af37f3258e19d7767f705708e63 (diff)
downloadhercules-dd73c6ea546a8828653cdce38a52f575cbdd3b96.tar.gz
hercules-dd73c6ea546a8828653cdce38a52f575cbdd3b96.tar.bz2
hercules-dd73c6ea546a8828653cdce38a52f575cbdd3b96.tar.xz
hercules-dd73c6ea546a8828653cdce38a52f575cbdd3b96.zip
* Added experimental support for CMake. (for now: basic build, no extras, only tested with VS10 and cygwin)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14872 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to '3rdparty/zlib')
-rw-r--r--3rdparty/zlib/CMakeLists.txt90
1 files changed, 90 insertions, 0 deletions
diff --git a/3rdparty/zlib/CMakeLists.txt b/3rdparty/zlib/CMakeLists.txt
new file mode 100644
index 000000000..849813be0
--- /dev/null
+++ b/3rdparty/zlib/CMakeLists.txt
@@ -0,0 +1,90 @@
+
+#
+# local copy
+#
+if( WIN32 )
+message( STATUS "Detecting local ZLIB" )
+find_path( LOCAL_ZLIB_INCLUDE_DIRS "zlib.h"
+ PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
+ NO_DEFAULT_PATH )
+find_library( LOCAL_ZLIB_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 )
+
+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]+\"[^\"]+\".*$" )
+ string( REGEX REPLACE "^.*ZLIB_VERSION[ \t]+\"([^\"]+)\".*$" "\\1" ZLIB_VERSION "${ZLIB_H}" )
+ message( STATUS "Found local ZLIB: ${LOCAL_ZLIB_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 )
+ if( NOT "${_VAR}" )
+ set( MISSING_VARS ${MISSING_VARS} ${_VAR} )
+ endif()
+ endforeach()
+ message( STATUS "Could NOT find local ZLIB (missing: ${MISSING_VARS})" )
+ unset( HAVE_LOCAL_ZLIB CACHE )
+endif()
+message( STATUS "Detecting local ZLIB - done" )
+endif( WIN32 )
+
+
+#
+# system
+#
+message( STATUS "Detecting system ZLIB" )
+find_package( ZLIB )
+set( SYSTEM_ZLIB_LIBRARIES ${ZLIB_LIBRARIES}
+ CACHE PATH "system zlib libraries" )
+set( SYSTEM_ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}
+ CACHE PATH "system zlib include directories" )
+mark_as_advanced( SYSTEM_ZLIB_LIBRARIES )
+mark_as_advanced( SYSTEM_ZLIB_INCLUDE_DIRS )
+
+if( SYSTEM_ZLIB_LIBRARIES AND SYSTEM_ZLIB_INCLUDE_DIRS )
+ set( HAVE_SYSTEM_ZLIB ON
+ CACHE BOOL "zlib is available on the system" )
+else()
+ unset( HAVE_SYSTEM_ZLIB CACHE )
+endif()
+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 )