CMakeLists.txt
author Ryan C. Gordon <icculus@icculus.org>
Tue, 15 Aug 2017 02:08:24 -0400
changeset 1587 3396e6dd19fb
parent 1549 59ee9cc813c8
child 1588 59a7ec36bd8c
permissions -rw-r--r--
Bump version to 2.1.1, since we've been at 2.1.0 for 8.5 years. :) There isn't going to be an official 2.1.1 (or 2.1.0) release; we'll let this marinate a little and jump to 3.0!
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
#
809
116b8fe30371 Renamed LICENSE to LICENSE.txt
Ryan C. Gordon <icculus@icculus.org>
parents: 805
diff changeset
     3
# 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
     4
1440
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
     5
# The CMake project file is meant to get this compiling on all sorts of
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
     6
#  platforms quickly, and serve as the way Unix platforms and Linux distros
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
     7
#  package up official builds, but you don't _need_ to use this; we have
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
     8
#  built PhysicsFS to (hopefully) be able to drop into your project and
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
     9
#  compile, using preprocessor checks for platform-specific bits instead of
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
    10
#  testing in here.
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
    11
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    12
cmake_minimum_required(VERSION 2.8.4)
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
    13
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    14
project(PhysicsFS)
1587
3396e6dd19fb Bump version to 2.1.1, since we've been at 2.1.0 for 8.5 years. :)
Ryan C. Gordon <icculus@icculus.org>
parents: 1549
diff changeset
    15
set(PHYSFS_VERSION 2.1.1)
950
7bb0b0d26479 Corrected soname.
Ryan C. Gordon <icculus@icculus.org>
parents: 919
diff changeset
    16
7bb0b0d26479 Corrected soname.
Ryan C. Gordon <icculus@icculus.org>
parents: 919
diff changeset
    17
# Increment this if/when we break backwards compatibility.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    18
set(PHYSFS_SOVERSION 1)
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    19
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    20
# I hate that they define "WIN32" ... we're about to move to Win64...I hope!
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    21
if(WIN32 AND NOT WINDOWS)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    22
    set(WINDOWS TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    23
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    24
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    25
include_directories(./src)
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    26
1440
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
    27
if(APPLE)
1549
59ee9cc813c8 apple: Start using some Cocoa APIs, clean up a few related things.
Ryan C. Gordon <icculus@icculus.org>
parents: 1548
diff changeset
    28
    set(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-framework IOKit -framework Foundation")
1548
576e95c756b5 Rename physfs_platform_macos.c to physfs_platform_apple.m
Ryan C. Gordon <icculus@icculus.org>
parents: 1547
diff changeset
    29
    set(PHYSFS_M_SRCS src/physfs_platform_apple.m)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    30
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    31
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    32
if(CMAKE_COMPILER_IS_GNUCC)
1040
5fc90d008821 Prevent bogus addition of -rpath to libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 1039
diff changeset
    33
    # Don't use -rpath.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    34
    set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    35
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    36
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    37
if(CMAKE_C_COMPILER_ID STREQUAL "SunPro")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    38
    add_definitions(-erroff=E_EMPTY_TRANSLATION_UNIT)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    39
    add_definitions(-xldscope=hidden)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    40
endif()
989
70132355a297 Ignore empty files (like #ifdef'd out platform code) on Sun Studio compiler.
Ryan C. Gordon <icculus@icculus.org>
parents: 985
diff changeset
    41
1443
0e74405d587f Removed BeOS support (Haiku still supported, though!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1440
diff changeset
    42
if(HAIKU)
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
    43
    # We add this explicitly, since we don't want CMake to think this
1443
0e74405d587f Removed BeOS support (Haiku still supported, though!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1440
diff changeset
    44
    #  is a C++ project unless we're on Haiku.
1518
a6ac19814d53 Serious cleanup and update of Windows RT support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1506
diff changeset
    45
    set(PHYSFS_CPP_SRCS src/physfs_platform_haiku.cpp)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    46
    find_library(BE_LIBRARY be)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    47
    find_library(ROOT_LIBRARY root)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    48
    set(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${BE_LIBRARY} ${ROOT_LIBRARY})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    49
endif()
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
    50
1518
a6ac19814d53 Serious cleanup and update of Windows RT support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1506
diff changeset
    51
if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
1519
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
    52
    set(WINRT TRUE)
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
    53
endif()
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
    54
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
    55
if(WINRT)
1518
a6ac19814d53 Serious cleanup and update of Windows RT support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1506
diff changeset
    56
    set(PHYSFS_CPP_SRCS src/physfs_platform_winrt.cpp)
a6ac19814d53 Serious cleanup and update of Windows RT support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1506
diff changeset
    57
endif()
a6ac19814d53 Serious cleanup and update of Windows RT support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1506
diff changeset
    58
1440
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
    59
if(UNIX AND NOT WINDOWS AND NOT APPLE)  # (MingW and such might be UNIX _and_ WINDOWS!)
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
    60
    find_library(PTHREAD_LIBRARY pthread)
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
    61
    if(PTHREAD_LIBRARY)
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
    62
        set(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${PTHREAD_LIBRARY})
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
    63
    endif()
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
    64
endif()
874043e29d55 Simplify CMakeLists.txt, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 1438
diff changeset
    65
818
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
    66
# Almost everything is "compiled" here, but things that don't apply to the
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
    67
#  build are #ifdef'd out. This is to make it easy to embed PhysicsFS into
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
    68
#  another project or bring up a new build system: just compile all the source
e36f23f49042 Now compiles everything whether we need it or not, removing whole files with
Ryan C. Gordon <icculus@icculus.org>
parents: 809
diff changeset
    69
#  code and #define the things you want.
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    70
set(PHYSFS_SRCS
972
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
    71
    src/physfs.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
    72
    src/physfs_byteorder.c
254427fc42ab Moved directory structure around.
Ryan C. Gordon <icculus@icculus.org>
parents: 956
diff changeset
    73
    src/physfs_unicode.c
1506
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    74
    src/physfs_platform_posix.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    75
    src/physfs_platform_unix.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    76
    src/physfs_platform_windows.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    77
    src/physfs_platform_os2.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    78
    src/physfs_archiver_dir.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    79
    src/physfs_archiver_unpacked.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    80
    src/physfs_archiver_grp.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    81
    src/physfs_archiver_hog.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    82
    src/physfs_archiver_7z.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    83
    src/physfs_archiver_mvl.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    84
    src/physfs_archiver_qpak.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    85
    src/physfs_archiver_wad.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    86
    src/physfs_archiver_zip.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    87
    src/physfs_archiver_slb.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    88
    src/physfs_archiver_iso9660.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    89
    src/physfs_archiver_vdf.c
1518
a6ac19814d53 Serious cleanup and update of Windows RT support.
Ryan C. Gordon <icculus@icculus.org>
parents: 1506
diff changeset
    90
    ${PHYSFS_CPP_SRCS}
1548
576e95c756b5 Rename physfs_platform_macos.c to physfs_platform_apple.m
Ryan C. Gordon <icculus@icculus.org>
parents: 1547
diff changeset
    91
    ${PHYSFS_M_SRCS}
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    92
)
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    93
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    94
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    95
# Archivers ...
1438
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
    96
# These are (mostly) on by default now, so these options are only useful for
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
    97
#  disabling them.
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    98
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
    99
option(PHYSFS_ARCHIVE_ZIP "Enable ZIP support" TRUE)
1438
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   100
if(NOT PHYSFS_ARCHIVE_ZIP)
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   101
    add_definitions(-DPHYSFS_SUPPORTS_ZIP=0)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   102
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   103
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   104
option(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE)
1467
75091b2a2a94 Rewrote the 7zip archiver.
Ryan C. Gordon <icculus@icculus.org>
parents: 1450
diff changeset
   105
if(NOT PHYSFS_ARCHIVE_7Z)
1438
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   106
    add_definitions(-DPHYSFS_SUPPORTS_7Z=0)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   107
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   108
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   109
option(PHYSFS_ARCHIVE_GRP "Enable Build Engine GRP support" TRUE)
1438
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   110
if(NOT PHYSFS_ARCHIVE_GRP)
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   111
    add_definitions(-DPHYSFS_SUPPORTS_GRP=0)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   112
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   114
option(PHYSFS_ARCHIVE_WAD "Enable Doom WAD support" TRUE)
1438
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   115
if(NOT PHYSFS_ARCHIVE_WAD)
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   116
    add_definitions(-DPHYSFS_SUPPORTS_WAD=0)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   117
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   119
option(PHYSFS_ARCHIVE_HOG "Enable Descent I/II HOG support" TRUE)
1438
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   120
if(NOT PHYSFS_ARCHIVE_HOG)
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   121
    add_definitions(-DPHYSFS_SUPPORTS_HOG=0)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   122
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   124
option(PHYSFS_ARCHIVE_MVL "Enable Descent I/II MVL support" TRUE)
1438
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   125
if(NOT PHYSFS_ARCHIVE_MVL)
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   126
    add_definitions(-DPHYSFS_SUPPORTS_MVL=0)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   127
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   129
option(PHYSFS_ARCHIVE_QPAK "Enable Quake I/II QPAK support" TRUE)
1438
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   130
if(NOT PHYSFS_ARCHIVE_QPAK)
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   131
    add_definitions(-DPHYSFS_SUPPORTS_QPAK=0)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   132
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   133
1315
c686e4f84ab5 SLB archiver
Aleksi Nurmi <aleksi.nurmi@gmail.com>
parents: 1311
diff changeset
   134
option(PHYSFS_ARCHIVE_SLB "Enable I-War / Independence War SLB support" TRUE)
1438
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   135
if(NOT PHYSFS_ARCHIVE_SLB)
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   136
    add_definitions(-DPHYSFS_SUPPORTS_SLB=0)
1315
c686e4f84ab5 SLB archiver
Aleksi Nurmi <aleksi.nurmi@gmail.com>
parents: 1311
diff changeset
   137
endif()
c686e4f84ab5 SLB archiver
Aleksi Nurmi <aleksi.nurmi@gmail.com>
parents: 1311
diff changeset
   138
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   139
option(PHYSFS_ARCHIVE_ISO9660 "Enable ISO9660 support" TRUE)
1438
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   140
if(NOT PHYSFS_ARCHIVE_ISO9660)
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   141
    add_definitions(-DPHYSFS_SUPPORTS_ISO9660=0)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   142
endif()
1066
e1d83e3b5d32 Make ISO9660 archiver optional.
Ryan C. Gordon <icculus@icculus.org>
parents: 1064
diff changeset
   143
1391
06aa5aca8518 Add support for VDF
Francesco Bertolaccini <bertolaccinifrancesco@gmail.com>
parents: 1338
diff changeset
   144
option(PHYSFS_ARCHIVE_VDF "Enable Gothic I/II VDF archive support" TRUE)
1438
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   145
if(NOT PHYSFS_ARCHIVE_VDF)
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
   146
    add_definitions(-DPHYSFS_SUPPORTS_VDF=0)
1391
06aa5aca8518 Add support for VDF
Francesco Bertolaccini <bertolaccinifrancesco@gmail.com>
parents: 1338
diff changeset
   147
endif()
06aa5aca8518 Add support for VDF
Francesco Bertolaccini <bertolaccinifrancesco@gmail.com>
parents: 1338
diff changeset
   148
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   150
option(PHYSFS_BUILD_STATIC "Build static library" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   151
if(PHYSFS_BUILD_STATIC)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   152
    add_library(physfs-static STATIC ${PHYSFS_SRCS})
1436
c18e307b5fc3 Don't rename the static library on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents: 1435
diff changeset
   153
    # Don't rename this on Windows, since DLLs will also produce an import
c18e307b5fc3 Don't rename the static library on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents: 1435
diff changeset
   154
    #  library named "physfs.lib" which would conflict; Unix tend to like the
c18e307b5fc3 Don't rename the static library on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents: 1435
diff changeset
   155
    #  same library name with a different extension for static libs, but
c18e307b5fc3 Don't rename the static library on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents: 1435
diff changeset
   156
    #  Windows can just have a separate name.
c18e307b5fc3 Don't rename the static library on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents: 1435
diff changeset
   157
    if(NOT WINDOWS)
c18e307b5fc3 Don't rename the static library on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents: 1435
diff changeset
   158
        set_target_properties(physfs-static PROPERTIES OUTPUT_NAME "physfs")
c18e307b5fc3 Don't rename the static library on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents: 1435
diff changeset
   159
    endif()
1519
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
   160
    if(WINRT)
1521
0b052d88ca0d WinRT: Disable harmless (in our case) linker warning.
Ryan C. Gordon <icculus@icculus.org>
parents: 1519
diff changeset
   161
        # Ignore LNK4264 warnings; we don't author any WinRT components, just consume them, so we're okay in a static library.
1519
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
   162
		set_target_properties(physfs-static PROPERTIES VS_WINRT_COMPONENT True)
1521
0b052d88ca0d WinRT: Disable harmless (in our case) linker warning.
Ryan C. Gordon <icculus@icculus.org>
parents: 1519
diff changeset
   163
        set_target_properties(physfs-static PROPERTIES STATIC_LIBRARY_FLAGS "/ignore:4264")
1519
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
   164
    endif()
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
   165
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   166
    set(PHYSFS_LIB_TARGET physfs-static)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   167
    set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs-static")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   168
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   169
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   170
option(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   171
if(PHYSFS_BUILD_SHARED)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   172
    add_library(physfs SHARED ${PHYSFS_SRCS})
1547
ff5d87cb8eef cmake: Pacify warning about Policy CMP0042 not being set.
Ryan C. Gordon <icculus@icculus.org>
parents: 1521
diff changeset
   173
    set_target_properties(physfs PROPERTIES MACOSX_RPATH 1)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   174
    set_target_properties(physfs PROPERTIES VERSION ${PHYSFS_VERSION})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   175
    set_target_properties(physfs PROPERTIES SOVERSION ${PHYSFS_SOVERSION})
1519
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
   176
    if(WINRT)
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
   177
		set_target_properties(physfs PROPERTIES VS_WINRT_COMPONENT True)
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
   178
    endif()
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   179
    target_link_libraries(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   180
    set(PHYSFS_LIB_TARGET physfs)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   181
    set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";physfs")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   182
endif()
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   183
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   184
if(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   185
    message(FATAL "Both shared and static libraries are disabled!")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   186
endif()
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   187
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   188
# CMake FAQ says I need this...
1436
c18e307b5fc3 Don't rename the static library on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents: 1435
diff changeset
   189
if(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC AND NOT WINDOWS)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   190
    set_target_properties(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   191
    set_target_properties(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   192
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   193
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   194
option(PHYSFS_BUILD_TEST "Build stdio test program." TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   195
mark_as_advanced(PHYSFS_BUILD_TEST)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   196
if(PHYSFS_BUILD_TEST)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   197
    find_path(READLINE_H readline/readline.h)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   198
    find_path(HISTORY_H readline/history.h)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   199
    if(READLINE_H AND HISTORY_H)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   200
        find_library(CURSES_LIBRARY NAMES curses ncurses)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   201
        set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   202
        find_library(READLINE_LIBRARY readline)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   203
        if(READLINE_LIBRARY)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   204
            set(HAVE_SYSTEM_READLINE TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   205
            set(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   206
            include_directories(${READLINE_H} ${HISTORY_H})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   207
            add_definitions(-DPHYSFS_HAVE_READLINE=1)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   208
        endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   209
    endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   210
    add_executable(test_physfs test/test_physfs.c)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   211
    target_link_libraries(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   212
    set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   213
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   214
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   215
install(TARGETS ${PHYSFS_INSTALL_TARGETS}
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   216
        RUNTIME DESTINATION bin
1140
079b6bf97b23 Use LIB_SUFFIX to install to lib64 instead of lib (thanks, Cristian!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1139
diff changeset
   217
        LIBRARY DESTINATION lib${LIB_SUFFIX}
079b6bf97b23 Use LIB_SUFFIX to install to lib64 instead of lib (thanks, Cristian!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1139
diff changeset
   218
        ARCHIVE DESTINATION lib${LIB_SUFFIX})
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   219
install(FILES src/physfs.h DESTINATION include)
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   220
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   221
find_package(Doxygen)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   222
if(DOXYGEN_FOUND)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   223
    set(PHYSFS_OUTPUT_DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   224
    configure_file(
1153
5cbedebaa623 Corrected doc paths for development branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 1152
diff changeset
   225
        "${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile"
1151
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   226
        "${PHYSFS_OUTPUT_DOXYFILE}"
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   227
        COPYONLY
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   228
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   229
    file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n\n# Below auto-generated by cmake...\n\n")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   230
    file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "PROJECT_NUMBER = \"${PHYSFS_VERSION}\"\n")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   231
    file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "OUTPUT_DIRECTORY = \"${CMAKE_CURRENT_BINARY_DIR}/docs\"\n")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   232
    file(APPEND "${PHYSFS_OUTPUT_DOXYFILE}" "\n# End auto-generated section.\n\n")
1151
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   233
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   234
    add_custom_target(
1151
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   235
        docs
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   236
        ${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   237
        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   238
        COMMENT "Building documentation in 'docs' directory..."
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   239
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   240
else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   241
    message(STATUS "Doxygen not found. You won't be able to build documentation.")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   242
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   243
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   244
if(UNIX)
1310
3382edc8a7f9 Use .tar.bz2 on this branch, too.
Ryan C. Gordon <icculus@icculus.org>
parents: 1309
diff changeset
   245
    set(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.bz2")
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   246
    add_custom_target(
1041
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   247
        dist
1310
3382edc8a7f9 Use .tar.bz2 on this branch, too.
Ryan C. Gordon <icculus@icculus.org>
parents: 1309
diff changeset
   248
        hg archive -t tbz2 "${PHYSFS_TARBALL}"
1042
dc9291957a5a Fixed "make dist" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 1041
diff changeset
   249
        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
dc9291957a5a Fixed "make dist" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 1041
diff changeset
   250
        COMMENT "Building source tarball '${PHYSFS_TARBALL}'..."
1041
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   251
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   252
    add_custom_target(
1041
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   253
        uninstall
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   254
        "${CMAKE_CURRENT_SOURCE_DIR}/extras/uninstall.sh"
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   255
        WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   256
        COMMENT "Uninstall the project..."
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   257
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   258
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   259
1338
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   260
if(UNIX AND NOT APPLE)
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   261
    configure_file(
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   262
        "extras/physfs.pc.in"
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   263
        "extras/physfs.pc"
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   264
        @ONLY
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   265
    )
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   266
    install(
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   267
        FILES "${CMAKE_CURRENT_BINARY_DIR}/extras/physfs.pc"
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   268
        DESTINATION "lib/pkgconfig"
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   269
    )
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   270
endif()
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   271
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   272
macro(message_bool_option _NAME _VALUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   273
    if(${_VALUE})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   274
        message(STATUS "  ${_NAME}: enabled")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   275
    else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   276
        message(STATUS "  ${_NAME}: disabled")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   277
    endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   278
endmacro()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   279
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   280
message(STATUS "PhysicsFS will build with the following options:")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   281
message_bool_option("ZIP support" PHYSFS_ARCHIVE_ZIP)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   282
message_bool_option("7zip support" PHYSFS_ARCHIVE_7Z)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   283
message_bool_option("GRP support" PHYSFS_ARCHIVE_GRP)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   284
message_bool_option("WAD support" PHYSFS_ARCHIVE_WAD)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   285
message_bool_option("HOG support" PHYSFS_ARCHIVE_HOG)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   286
message_bool_option("MVL support" PHYSFS_ARCHIVE_MVL)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   287
message_bool_option("QPAK support" PHYSFS_ARCHIVE_QPAK)
1315
c686e4f84ab5 SLB archiver
Aleksi Nurmi <aleksi.nurmi@gmail.com>
parents: 1311
diff changeset
   288
message_bool_option("SLB support" PHYSFS_ARCHIVE_SLB)
1435
27e8dfc42ecd Added some option information to the CMake output.
Ryan C. Gordon <icculus@icculus.org>
parents: 1434
diff changeset
   289
message_bool_option("VDF support" PHYSFS_ARCHIVE_VDF)
27e8dfc42ecd Added some option information to the CMake output.
Ryan C. Gordon <icculus@icculus.org>
parents: 1434
diff changeset
   290
message_bool_option("ISO9660 support" PHYSFS_ARCHIVE_ISO9660)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   291
message_bool_option("Build static library" PHYSFS_BUILD_STATIC)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   292
message_bool_option("Build shared library" PHYSFS_BUILD_SHARED)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   293
message_bool_option("Build stdio test program" PHYSFS_BUILD_TEST)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   294
if(PHYSFS_BUILD_TEST)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   295
    message_bool_option("  Use readline in test program" HAVE_SYSTEM_READLINE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   296
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   297
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   298
# end of CMakeLists.txt ...
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   299