CMakeLists.txt
author Ryan C. Gordon <icculus@icculus.org>
Sun, 11 Mar 2007 10:10:28 +0000
changeset 809 116b8fe30371
parent 805 b462f06edbca
child 818 e36f23f49042
permissions -rw-r--r--
Renamed LICENSE to LICENSE.txt
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
# PhysicsFS; a portable, flexible file i/o abstraction.
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
# Copyright (C) 2007  Ryan C. Gordon.
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
#
809
116b8fe30371 Renamed LICENSE to LICENSE.txt
Ryan C. Gordon <icculus@icculus.org>
parents: 805
diff changeset
     4
# Please see the file LICENSE.txt in the source's root directory.
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
     6
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
     7
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     8
PROJECT(PhysicsFS)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
SET(PHYSFS_VERSION 1.1.2)
805
b462f06edbca Install libraries with a VERSION and SOVERSION.
Ryan C. Gordon <icculus@icculus.org>
parents: 804
diff changeset
    10
SET(PHYSFS_SOVERSION 1)
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    12
# I hate that they define "WIN32" ... we're about to move to Win64...I hope!
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    13
IF(WIN32 AND NOT WINDOWS)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    14
    SET(WINDOWS TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    15
ENDIF(WIN32 AND NOT WINDOWS)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    16
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    17
# Bleh, let's do it for "APPLE" too.
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    18
IF(APPLE AND NOT MACOSX)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
    SET(MACOSX TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
ENDIF(APPLE AND NOT MACOSX)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    21
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    22
INCLUDE(CheckIncludeFile)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    23
INCLUDE(CheckLibraryExists)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
INCLUDE(CheckCSourceCompiles)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    25
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
INCLUDE_DIRECTORIES(.)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    27
#INCLUDE_DIRECTORIES(platform)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    28
#INCLUDE_DIRECTORIES(archivers)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    29
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    30
IF(MACOSX)
803
4b1e0994ab97 Clarified a comment.
Ryan C. Gordon <icculus@icculus.org>
parents: 802
diff changeset
    31
    # Fallback to older OS X on PowerPC to support wider range of systems...
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    32
    IF(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
801
a6d25b52f2c7 Fixes to CMakeLists.txt for Intel Mac.
Ryan C. Gordon <icculus@icculus.org>
parents: 799
diff changeset
    33
        ADD_DEFINITIONS(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020)
a6d25b52f2c7 Fixes to CMakeLists.txt for Intel Mac.
Ryan C. Gordon <icculus@icculus.org>
parents: 799
diff changeset
    34
        SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -mmacosx-version-min=10.2")
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    35
    ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
803
4b1e0994ab97 Clarified a comment.
Ryan C. Gordon <icculus@icculus.org>
parents: 802
diff changeset
    36
4b1e0994ab97 Clarified a comment.
Ryan C. Gordon <icculus@icculus.org>
parents: 802
diff changeset
    37
    # Need these everywhere...
4b1e0994ab97 Clarified a comment.
Ryan C. Gordon <icculus@icculus.org>
parents: 802
diff changeset
    38
    ADD_DEFINITIONS(-fno-common)
801
a6d25b52f2c7 Fixes to CMakeLists.txt for Intel Mac.
Ryan C. Gordon <icculus@icculus.org>
parents: 799
diff changeset
    39
    SET(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -framework Carbon -framework IOKit")
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    40
ENDIF(MACOSX)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    41
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    42
# Add some gcc-specific command lines.
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    43
IF(CMAKE_COMPILER_IS_GNUCC)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    44
    # Always build with debug symbols...you can strip it later.
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    45
    ADD_DEFINITIONS(-g -pipe -Wall -Werror -fsigned-char)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    46
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    47
    CHECK_C_SOURCE_COMPILES("
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    48
        #if ((defined(__GNUC__)) && (__GNUC__ >= 4))
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    49
        int main(int argc, char **argv) { int is_gcc4 = 1; return 0; }
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    50
        #else
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    51
        #error This is not gcc4.
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    52
        #endif
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    53
    " PHYSFS_IS_GCC4)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    54
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    55
    IF(PHYSFS_IS_GCC4)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    56
        ADD_DEFINITIONS(-fvisibility=hidden)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    57
    ENDIF(PHYSFS_IS_GCC4)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    58
ENDIF(CMAKE_COMPILER_IS_GNUCC)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    59
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    60
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    61
# Basic chunks of source code ...
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    62
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    63
SET(ZLIB_SRCS
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    64
    zlib123/adler32.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    65
    zlib123/compress.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    66
    zlib123/crc32.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    67
    zlib123/deflate.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    68
    zlib123/gzio.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
    zlib123/infback.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
    zlib123/inffast.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
    zlib123/inflate.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72
    zlib123/inftrees.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    73
    zlib123/trees.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    74
    zlib123/uncompr.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
    zlib123/zutil.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    77
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
SET(LZMA_SRCS
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
    lzma/7zBuffer.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    80
    lzma/7zCrc.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    81
    lzma/7zDecode.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    82
    lzma/7zExtract.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    83
    lzma/7zHeader.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    84
    lzma/7zIn.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    85
    lzma/7zItem.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    86
    lzma/7zMethodID.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    87
    lzma/LzmaDecode.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    88
    lzma/LzmaStateDecode.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    89
)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    90
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    91
SET(PHYSFS_SRCS
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    92
    physfs.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    93
    physfs_byteorder.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    94
    physfs_unicode.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    95
    archivers/dir.c
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    96
)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    97
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    98
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    99
# platform layers ...
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   100
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   101
IF(UNIX)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   102
    SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/posix.c)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   103
    IF(BEOS)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
        SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/beos.cpp)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   105
        SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   106
    ELSE(BEOS)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   107
        SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/unix.c)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   108
        # !!! FIXME
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   109
        #  AC_DEFINE([PHYSFS_HAVE_LLSEEK], 1, [define if we have llseek])
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   110
        CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   111
        IF(HAVE_UCRED_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   112
            ADD_DEFINITIONS(-DPHYSFS_HAVE_SYS_UCRED_H=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
            SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
        ENDIF(HAVE_UCRED_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   115
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   116
        CHECK_INCLUDE_FILE(mntent.h HAVE_MNTENT_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   117
        IF(HAVE_MNTENT_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
            ADD_DEFINITIONS(-DPHYSFS_HAVE_MNTENT_H=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   119
            SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   120
        ENDIF(HAVE_MNTENT_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   121
    ENDIF(BEOS)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   122
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
    CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
    IF(HAVE_PTHREAD_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   125
        SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   126
    ELSE(HAVE_PTHREAD_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   127
        ADD_DEFINITIONS(-DPHYSFS_NO_PTHREADS_SUPPORT=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
    ENDIF(HAVE_PTHREAD_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
ENDIF(UNIX)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   130
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   131
IF(WINDOWS)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   132
    SET(PHYSFS_SRCS ${PHYSFS_SRCS} platform/windows.c)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   133
    SET(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   134
    SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   135
    # !!! FIXME: platform/pocketpc.c ... ?
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   136
ENDIF(WINDOWS)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   137
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
IF(NOT PHYSFS_HAVE_CDROM_SUPPORT)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
    ADD_DEFINITIONS(-DPHYSFS_NO_CDROM_SUPPORT=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   140
    MESSAGE(WARNING " ***")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   141
    MESSAGE(WARNING " *** There is no CD-ROM support in this build!")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
    MESSAGE(WARNING " *** PhysicsFS will just pretend there are no discs.")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   143
    MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   144
    MESSAGE(WARNING " ***   but is this what you REALLY wanted?")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   145
    MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   146
    MESSAGE(WARNING " ***")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
ENDIF(NOT PHYSFS_HAVE_CDROM_SUPPORT)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
IF(PHYSFS_HAVE_THREAD_SUPPORT)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
    ADD_DEFINITIONS(-D_REENTRANT -D_THREAD_SAFE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   151
ELSE(PHYSFS_HAVE_THREAD_SUPPORT)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   152
    MESSAGE(WARNING " ***")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   153
    MESSAGE(WARNING " *** There is no thread support in this build!")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   154
    MESSAGE(WARNING " *** PhysicsFS will NOT be reentrant!")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   155
    MESSAGE(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   156
    MESSAGE(WARNING " ***   but is this what you REALLY wanted?")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   157
    MESSAGE(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   158
    MESSAGE(WARNING " ***")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   159
ENDIF(PHYSFS_HAVE_THREAD_SUPPORT)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   160
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   161
# Archivers ...
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   162
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   163
OPTION(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   164
IF(PHYSFS_ARCHIVE_ZIP)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   165
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_ZIP=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   166
    SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/zip.c)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   167
    SET(PHYSFS_NEED_ZLIB TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   168
ENDIF(PHYSFS_ARCHIVE_ZIP)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   169
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   170
OPTION(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   171
IF(PHYSFS_ARCHIVE_7Z)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   172
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_7Z=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   173
    # !!! FIXME: rename to 7z.c?
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   174
    SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${LZMA_SRCS} archivers/lzma.c)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   175
    INCLUDE_DIRECTORIES(lzma)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   176
    ADD_DEFINITIONS(-D_LZMA_IN_CB=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   177
    ADD_DEFINITIONS(-D_LZMA_PROB32=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   178
    ADD_DEFINITIONS(-D_LZMA_SYSTEM_SIZE_T=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   179
    ADD_DEFINITIONS(-D_SZ_ONE_DIRECTORY=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   180
ENDIF(PHYSFS_ARCHIVE_7Z)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   181
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   182
OPTION(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   183
IF(PHYSFS_ARCHIVE_GRP)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   184
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_GRP=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   185
    SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/grp.c)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   186
ENDIF(PHYSFS_ARCHIVE_GRP)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   187
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   188
OPTION(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   189
IF(PHYSFS_ARCHIVE_WAD)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   190
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_WAD=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   191
    SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/wad.c)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   192
ENDIF(PHYSFS_ARCHIVE_WAD)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   193
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   194
OPTION(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   195
IF(PHYSFS_ARCHIVE_HOG)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   196
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_HOG=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   197
    SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/hog.c)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   198
ENDIF(PHYSFS_ARCHIVE_HOG)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   199
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   200
OPTION(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   201
IF(PHYSFS_ARCHIVE_MVL)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   202
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_MVL=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   203
    SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/mvl.c)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   204
ENDIF(PHYSFS_ARCHIVE_MVL)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   205
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   206
OPTION(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   207
IF(PHYSFS_ARCHIVE_QPAK)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   208
    ADD_DEFINITIONS(-DPHYSFS_SUPPORTS_QPAK=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   209
    SET(PHYSFS_SRCS ${PHYSFS_SRCS} archivers/qpak.c)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   210
ENDIF(PHYSFS_ARCHIVE_QPAK)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   211
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   212
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   213
# See if some archiver required zlib, and see about using system version.
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   214
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   215
IF(PHYSFS_NEED_ZLIB)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   216
    CHECK_INCLUDE_FILE(zlib.h HAVE_ZLIB_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   217
    IF(HAVE_ZLIB_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   218
        CHECK_LIBRARY_EXISTS("z" "inflate" "" HAVE_LIBZ)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   219
        IF(HAVE_LIBZ)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   220
            SET(HAVE_SYSTEM_ZLIB TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   221
        ENDIF(HAVE_LIBZ)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   222
    ENDIF(HAVE_ZLIB_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   223
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   224
    IF(HAVE_SYSTEM_ZLIB)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   225
        OPTION(PHYSFS_INTERNAL_ZLIB "Link own zlib instead of system library" FALSE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   226
    ELSE(HAVE_SYSTEM_ZLIB)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   227
        SET(PHYSFS_INTERNAL_ZLIB TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   228
    ENDIF(HAVE_SYSTEM_ZLIB)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   229
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   230
    IF(PHYSFS_INTERNAL_ZLIB)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   231
        INCLUDE_DIRECTORIES(zlib123)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   232
        ADD_DEFINITIONS(-DZ_PREFIX=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   233
        SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${ZLIB_SRCS})
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   234
    ELSE(PHYSFS_INTERNAL_ZLIB)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   235
        SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} z)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   236
    ENDIF(PHYSFS_INTERNAL_ZLIB)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   237
ENDIF(PHYSFS_NEED_ZLIB)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   238
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   239
OPTION(PHYSFS_BUILD_STATIC "Build static library" TRUE)
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   240
IF(PHYSFS_BUILD_STATIC)
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   241
    ADD_LIBRARY(physfs-static STATIC ${PHYSFS_SRCS})
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   242
    SET_TARGET_PROPERTIES(physfs-static PROPERTIES OUTPUT_NAME "physfs")
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   243
    SET(PHYSFS_LIB_TARGET physfs-static)
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   244
    SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs")
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   245
ENDIF(PHYSFS_BUILD_STATIC)
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   246
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   247
OPTION(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   248
IF(PHYSFS_BUILD_SHARED)
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   249
    ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS})
805
b462f06edbca Install libraries with a VERSION and SOVERSION.
Ryan C. Gordon <icculus@icculus.org>
parents: 804
diff changeset
   250
    SET_TARGET_PROPERTIES(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
b462f06edbca Install libraries with a VERSION and SOVERSION.
Ryan C. Gordon <icculus@icculus.org>
parents: 804
diff changeset
   251
    SET_TARGET_PROPERTIES(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   252
    TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   253
    SET(PHYSFS_LIB_TARGET physfs)
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   254
    SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static")
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   255
ENDIF(PHYSFS_BUILD_SHARED)
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   256
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   257
IF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   258
    MESSAGE(FATAL "Both shared and static libraries are disabled!")
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   259
ENDIF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   260
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   261
# CMake FAQ says I need this...
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   262
IF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   263
    SET_TARGET_PROPERTIES(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   264
    SET_TARGET_PROPERTIES(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   265
ENDIF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   266
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   267
OPTION(PHYSFS_BUILD_TEST "Build test program." TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   268
MARK_AS_ADVANCED(PHYSFS_BUILD_TEST)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   269
IF(PHYSFS_BUILD_TEST)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   270
    CHECK_INCLUDE_FILE(readline/readline.h HAVE_READLINE_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   271
    CHECK_INCLUDE_FILE(readline/history.h HAVE_HISTORY_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   272
    IF(HAVE_READLINE_H AND HAVE_HISTORY_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   273
        SET(CMAKE_REQUIRED_LIBRARIES curses)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   274
        CHECK_LIBRARY_EXISTS("readline" "readline" "" HAVE_LIBREADLINE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   275
        CHECK_LIBRARY_EXISTS("readline" "history" "" HAVE_LIBHISTORY)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   276
        IF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   277
            SET(HAVE_SYSTEM_READLINE TRUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   278
            SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} " " readline curses)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   279
            ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   280
        ENDIF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   281
    ENDIF(HAVE_READLINE_H AND HAVE_HISTORY_H)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   282
    ADD_EXECUTABLE(test_physfs test/test_physfs.c)
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   283
    TARGET_LINK_LIBRARIES(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   284
    SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   285
ENDIF(PHYSFS_BUILD_TEST)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   286
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   287
INSTALL(TARGETS ${PHYSFS_INSTALL_TARGETS}
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   288
        RUNTIME DESTINATION bin
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   289
        LIBRARY DESTINATION lib
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   290
        ARCHIVE DESTINATION lib)
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   291
INSTALL(FILES physfs.h DESTINATION include)
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   292
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   293
FIND_PACKAGE(Doxygen)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   294
IF(DOXYGEN_FOUND)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   295
    ADD_CUSTOM_TARGET(docs ${DOXYGEN_EXECUTABLE} COMMENT "Building documentation")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   296
ELSE(DOXYGEN_FOUND)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   297
    MESSAGE(STATUS "Doxygen not found. You won't be able to build documentation.")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   298
ENDIF(DOXYGEN_FOUND)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   299
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   300
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   301
MACRO(MESSAGE_BOOL_OPTION _NAME _VALUE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   302
    IF(${_VALUE})
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   303
        MESSAGE(STATUS "  ${_NAME}: enabled")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   304
    ELSE(${_VALUE})
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   305
        MESSAGE(STATUS "  ${_NAME}: disabled")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   306
    ENDIF(${_VALUE})
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   307
ENDMACRO(MESSAGE_BOOL_OPTION)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   308
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   309
MESSAGE(STATUS "PhysicsFS will build with the following options:")
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   310
MESSAGE_BOOL_OPTION("ZIP support" PHYSFS_ARCHIVE_ZIP)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   311
MESSAGE_BOOL_OPTION("7zip support" PHYSFS_ARCHIVE_7Z)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   312
MESSAGE_BOOL_OPTION("GRP support" PHYSFS_ARCHIVE_GRP)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   313
MESSAGE_BOOL_OPTION("WAD support" PHYSFS_ARCHIVE_WAD)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   314
MESSAGE_BOOL_OPTION("HOG support" PHYSFS_ARCHIVE_HOG)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   315
MESSAGE_BOOL_OPTION("MVL support" PHYSFS_ARCHIVE_MVL)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   316
MESSAGE_BOOL_OPTION("QPAK support" PHYSFS_ARCHIVE_QPAK)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   317
MESSAGE_BOOL_OPTION("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   318
MESSAGE_BOOL_OPTION("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   319
MESSAGE_BOOL_OPTION("Build own zlib" PHYSFS_INTERNAL_ZLIB)
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   320
MESSAGE_BOOL_OPTION("Build static library" PHYSFS_BUILD_STATIC)
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   321
MESSAGE_BOOL_OPTION("Build shared library" PHYSFS_BUILD_SHARED)
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   322
MESSAGE_BOOL_OPTION("Build test program" PHYSFS_BUILD_TEST)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   323
IF(PHYSFS_BUILD_TEST)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   324
    MESSAGE_BOOL_OPTION("  Use readline in test program" HAVE_SYSTEM_READLINE)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   325
ENDIF(PHYSFS_BUILD_TEST)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   326
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   327
# end of CMakeLists.txt ...
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   328