misc/physfs/CMakeLists.txt
author Urbertar@gmail.com
Sat, 23 Feb 2013 19:12:11 +0200
branchicegun
changeset 8548 b98631bf2066
parent 8360 082ccf48bc06
child 8363 0b4ac686fc44
child 8444 75db7bb8dce8
permissions -rw-r--r--
Add land freezing
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     1
# PhysicsFS; a portable, flexible file i/o abstraction.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     2
# Copyright (C) 2007  Ryan C. Gordon.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     3
#
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     4
# Please see the file LICENSE.txt in the source's root directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     5
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
     6
## lines starting with '##' are lines overridden/modified/added by Hedgewars configuration
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
     7
##CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
     8
##PROJECT(PhysicsFS)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
     9
set(PHYSFS_VERSION 2.1.0)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    10
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    11
# Increment this if/when we break backwards compatibility.
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    12
set(PHYSFS_SOVERSION 1)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    13
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    14
# I hate that they define "WIN32" ... we're about to move to Win64...I hope!
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    15
if(WIN32 AND NOT WINDOWS)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    16
    set(WINDOWS TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    17
endif(WIN32 AND NOT WINDOWS)
8286
2e7eedac380d Fix windows build broken in raf97cdbb7713
unc0rr
parents: 8283
diff changeset
    18
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    19
# Bleh, let's do it for "APPLE" too.
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    20
if(APPLE AND NOT MACOSX)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    21
    set(MACOSX TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    22
endif(APPLE AND NOT MACOSX)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    23
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    24
# For now, Haiku and BeOS are the same, as far as the build system cares.
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    25
if(HAIKU AND NOT BEOS)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    26
    set(BEOS TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    27
endif(HAIKU AND NOT BEOS)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    28
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    29
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    30
    set(SOLARIS TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    31
endif(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    32
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    33
include(CheckIncludeFile)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    34
include(CheckLibraryExists)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    35
include(CheckCSourceCompiles)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    36
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    37
## SDL is needed by extra
8288
fd6743995dfc Fix linux build broken in ra1577759bf62 (probably)
koda
parents: 8286
diff changeset
    38
find_package(SDL REQUIRED)
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    39
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) ##
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    40
include_directories(${SDL_INCLUDE_DIR}) ##
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    41
include_directories(${LUA_INCLUDE_DIR}) ##
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    42
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    43
if(MACOSX)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    44
    # Fallback to older OS X on PowerPC to support wider range of systems...
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    45
    if(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    46
        add_definitions(-DMAC_OS_X_VERSION_MIN_REQUIRED=1020)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    47
        set(OTHER_LDFLAGS ${OTHER_LDFLAGS} " -mmacosx-version-min=10.2")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    48
    endif(CMAKE_OSX_ARCHITECTURES MATCHES ppc)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    49
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    50
    # Need these everywhere...
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    51
    add_definitions(-fno-common)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    52
    find_library(iokit_framework NAMES IOKit)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    53
    list(APPEND OTHER_LDFLAGS ${iokit_framework})
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    54
endif(MACOSX)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    55
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    56
# Add some gcc-specific command lines.
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    57
if(CMAKE_COMPILER_IS_GNUCC)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    58
    # Always build with debug symbols...you can strip it later.
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    59
    add_definitions(-g -pipe -Werror -fsigned-char)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    60
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    61
    # Stupid BeOS generates warnings in the system headers.
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    62
    if(NOT BEOS)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    63
        add_definitions(-Wall)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    64
    endif(NOT BEOS)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    65
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    66
    CHECK_C_SOURCE_COMPILES("
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    67
        #if ((defined(__GNUC__)) && (__GNUC__ >= 4))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    68
        int main(int argc, char **argv) { int is_gcc4 = 1; return 0; }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    69
        #else
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    70
        #error This is not gcc4.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    71
        #endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    72
    " PHYSFS_IS_GCC4)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    73
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    74
    if(PHYSFS_IS_GCC4)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    75
        # Not supported on several operating systems at this time.
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    76
        if(NOT SOLARIS AND NOT WINDOWS)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    77
            add_definitions(-fvisibility=hidden)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    78
        endif(NOT SOLARIS AND NOT WINDOWS)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    79
    endif(PHYSFS_IS_GCC4)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    80
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    81
    # Don't use -rpath.
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    82
    set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    83
endif(CMAKE_COMPILER_IS_GNUCC)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    84
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    85
if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    86
    add_definitions(-erroff=E_EMPTY_TRANSLATION_UNIT)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    87
    add_definitions(-xldscope=hidden)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    88
endif(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    89
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    90
if(MSVC)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    91
    # VS.NET 8.0 got really really anal about strcpy, etc, which even if we
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    92
    #  cleaned up our code, zlib, etc still use...so disable the warning.
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    93
    add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    94
endif(MSVC)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    95
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    96
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    97
# Basic chunks of source code ...
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
    98
set(LZMA_SRCS
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    99
    src/lzma/C/7zCrc.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   100
    src/lzma/C/Archive/7z/7zBuffer.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   101
    src/lzma/C/Archive/7z/7zDecode.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   102
    src/lzma/C/Archive/7z/7zExtract.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   103
    src/lzma/C/Archive/7z/7zHeader.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   104
    src/lzma/C/Archive/7z/7zIn.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   105
    src/lzma/C/Archive/7z/7zItem.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   106
    src/lzma/C/Archive/7z/7zMethodID.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   107
    src/lzma/C/Compress/Branch/BranchX86.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   108
    src/lzma/C/Compress/Branch/BranchX86_2.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   109
    src/lzma/C/Compress/Lzma/LzmaDecode.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   110
)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   111
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   112
if(BEOS)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   113
    # We add this explicitly, since we don't want CMake to think this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   114
    #  is a C++ project unless we're on BeOS.
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   115
    set(PHYSFS_BEOS_SRCS src/platform_beos.cpp)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   116
    find_library(BE_LIBRARY be)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   117
    find_library(ROOT_LIBRARY root)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   118
    set(optionAL_LIBRARY_LIBS ${optionAL_LIBRARY_LIBS} ${BE_LIBRARY} ${ROOT_LIBRARY})
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   119
endif(BEOS)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   120
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   121
## extra functions needed by Hedgewars
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   122
## TODO: maybe it's better to have them in a separate library?
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   123
set(PHYSFS_HEDGE_SRCS
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   124
    extras/physfsrwops.c
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   125
    extras/physfslualoader.c
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   126
    extras/hwpacksmounter.c
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   127
)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   128
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   129
# Almost everything is "compiled" here, but things that don't apply to the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   130
#  build are #ifdef'd out. This is to make it easy to embed PhysicsFS into
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   131
#  another project or bring up a new build system: just compile all the source
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   132
#  code and #define the things you want.
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   133
set(PHYSFS_SRCS
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   134
    src/physfs.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   135
    src/physfs_byteorder.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   136
    src/physfs_unicode.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   137
    src/platform_posix.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   138
    src/platform_unix.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   139
    src/platform_macosx.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   140
    src/platform_windows.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   141
    src/archiver_dir.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   142
    src/archiver_unpacked.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   143
    src/archiver_grp.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   144
    src/archiver_hog.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   145
    src/archiver_lzma.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   146
    src/archiver_mvl.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   147
    src/archiver_qpak.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   148
    src/archiver_wad.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   149
    src/archiver_zip.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   150
    src/archiver_iso9660.c
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   151
    ${PHYSFS_BEOS_SRCS}
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   152
    ${PHYSFS_HEDGE_SRCS} ##
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   153
)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   154
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   155
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   156
# platform layers ...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   157
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   158
if(UNIX)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   159
    if(BEOS)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   160
        set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   161
        set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   162
        set(HAVE_PTHREAD_H TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   163
    else(BEOS)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   164
        CHECK_INCLUDE_FILE(sys/ucred.h HAVE_UCRED_H)
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   165
        if(HAVE_UCRED_H)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   166
            add_definitions(-DPHYSFS_HAVE_SYS_UCRED_H=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   167
            set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   168
        endif(HAVE_UCRED_H)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   169
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   170
        CHECK_INCLUDE_FILE(mntent.h HAVE_MNTENT_H)
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   171
        if(HAVE_MNTENT_H)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   172
            add_definitions(-DPHYSFS_HAVE_MNTENT_H=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   173
            set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   174
        endif(HAVE_MNTENT_H)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   175
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   176
        # !!! FIXME: Solaris fails this, because mnttab.h implicitly
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   177
        # !!! FIXME:  depends on other system headers.  :(
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   178
        #CHECK_INCLUDE_FILE(sys/mnttab.h HAVE_SYS_MNTTAB_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   179
        CHECK_C_SOURCE_COMPILES("
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   180
            #include <stdio.h>
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   181
            #include <sys/mnttab.h>
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   182
            int main(int argc, char **argv) { return 0; }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   183
        " HAVE_SYS_MNTTAB_H)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   184
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   185
        if(HAVE_SYS_MNTTAB_H)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   186
            add_definitions(-DPHYSFS_HAVE_SYS_MNTTAB_H=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   187
            set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   188
        endif(HAVE_SYS_MNTTAB_H)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   189
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   190
        CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   191
        if(HAVE_PTHREAD_H)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   192
            set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   193
        endif(HAVE_PTHREAD_H)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   194
    endif(BEOS)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   195
endif(UNIX)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   196
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   197
if(WINDOWS)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   198
    set(PHYSFS_HAVE_CDROM_SUPPORT TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   199
    set(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   200
endif(WINDOWS)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   201
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   202
if(NOT PHYSFS_HAVE_CDROM_SUPPORT)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   203
    add_definitions(-DPHYSFS_NO_CDROM_SUPPORT=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   204
    message(WARNING " ***")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   205
    message(WARNING " *** There is no CD-ROM support in this build!")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   206
    message(WARNING " *** PhysicsFS will just pretend there are no discs.")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   207
    message(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   208
    message(WARNING " ***   but is this what you REALLY wanted?")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   209
    message(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   210
    message(WARNING " ***")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   211
endif(NOT PHYSFS_HAVE_CDROM_SUPPORT)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   212
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   213
if(PHYSFS_HAVE_THREAD_SUPPORT)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   214
    add_definitions(-D_REENTRANT -D_THREAD_SAFE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   215
else(PHYSFS_HAVE_THREAD_SUPPORT)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   216
    add_definitions(-DPHYSFS_NO_THREAD_SUPPORT=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   217
    message(WARNING " ***")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   218
    message(WARNING " *** There is no thread support in this build!")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   219
    message(WARNING " *** PhysicsFS will NOT be reentrant!")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   220
    message(WARNING " *** This may be fine, depending on how PhysicsFS is used,")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   221
    message(WARNING " ***   but is this what you REALLY wanted?")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   222
    message(WARNING " *** (Maybe fix CMakeLists.txt, or write a platform driver?)")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   223
    message(WARNING " ***")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   224
endif(PHYSFS_HAVE_THREAD_SUPPORT)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   225
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   226
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   227
# Archivers ...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   228
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   229
option(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   230
if(PHYSFS_ARCHIVE_ZIP)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   231
    add_definitions(-DPHYSFS_SUPPORTS_ZIP=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   232
    set(PHYSFS_FEATURES "ZIP")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   233
endif(PHYSFS_ARCHIVE_ZIP)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   234
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   235
option(PHYSFS_ARCHIVE_7Z "Enable 7zip support" FALSE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   236
if(PHYSFS_ARCHIVE_7Z)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   237
    add_definitions(-DPHYSFS_SUPPORTS_7Z=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   238
    list(APPEND PHYSFS_SRCS ${LZMA_SRCS})
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   239
    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} 7zip")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   240
endif(PHYSFS_ARCHIVE_7Z)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   241
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   242
option(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   243
if(PHYSFS_ARCHIVE_GRP)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   244
    add_definitions(-DPHYSFS_SUPPORTS_GRP=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   245
    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} GRP")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   246
endif(PHYSFS_ARCHIVE_GRP)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   247
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   248
option(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   249
if(PHYSFS_ARCHIVE_WAD)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   250
    add_definitions(-DPHYSFS_SUPPORTS_WAD=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   251
    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} WAD")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   252
endif(PHYSFS_ARCHIVE_WAD)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   253
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   254
option(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   255
if(PHYSFS_ARCHIVE_HOG)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   256
    add_definitions(-DPHYSFS_SUPPORTS_HOG=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   257
    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} HOG")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   258
endif(PHYSFS_ARCHIVE_HOG)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   259
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   260
option(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   261
if(PHYSFS_ARCHIVE_MVL)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   262
    add_definitions(-DPHYSFS_SUPPORTS_MVL=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   263
    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} MVL")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   264
endif(PHYSFS_ARCHIVE_MVL)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   265
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   266
option(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   267
if(PHYSFS_ARCHIVE_QPAK)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   268
    add_definitions(-DPHYSFS_SUPPORTS_QPAK=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   269
    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} QPAK")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   270
endif(PHYSFS_ARCHIVE_QPAK)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   271
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   272
option(PHYSFS_ARCHIVE_ISO9660 "Enable ISO9660 support" TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   273
if(PHYSFS_ARCHIVE_ISO9660)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   274
    add_definitions(-DPHYSFS_SUPPORTS_ISO9660=1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   275
    set(PHYSFS_FEATURES "${PHYSFS_FEATURES} CD-ROM")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   276
endif(PHYSFS_ARCHIVE_ISO9660)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   277
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   278
##as needed by Hedgewars configuration
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   279
if(WINDOWS)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   280
    option(PHYSFS_BUILD_STATIC "Build static library" FALSE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   281
    option(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   282
    list(APPEND OTHER_LDFLAGS ${SDL_LIBRARY})
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   283
else(WINDOWS)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   284
    option(PHYSFS_BUILD_STATIC "Build static library" TRUE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   285
    option(PHYSFS_BUILD_SHARED "Build shared library" FALSE)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   286
endif(WINDOWS)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   287
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   288
if(PHYSFS_BUILD_STATIC)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   289
    add_library(physfs STATIC ${PHYSFS_SRCS})
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   290
    set_target_properties(physfs PROPERTIES OUTPUT_NAME "physfs")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   291
endif(PHYSFS_BUILD_STATIC)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   292
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   293
if(PHYSFS_BUILD_SHARED)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   294
    add_library(physfs SHARED ${PHYSFS_SRCS})
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   295
    set_target_properties(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   296
    set_target_properties(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   297
    target_link_libraries(physfs ${optionAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   298
    install(TARGETS physfs RUNTIME DESTINATION ${target_library_install_dir}) ##
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   299
endif(PHYSFS_BUILD_SHARED)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   300
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   301
if(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   302
    message(FATAL "Both shared and static libraries are disabled!")
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   303
endif(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   304
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   305
# CMake FAQ says I need this...
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   306
if(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   307
    set_target_properties(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   308
endif(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   309
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   310
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   311
## removed install, language bindings and test program
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   312
## simplified configuration output
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   313
8360
082ccf48bc06 simplified physfs cmake
koda
parents: 8316
diff changeset
   314
message(STATUS "PhysicsFS will build with ${PHYSFS_FEATURES} support")
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   315