CMakeLists.txt
author Ryan C. Gordon <icculus@icculus.org>
Sun, 17 May 2020 00:58:55 -0400
branchstable-3.0
changeset 1688 62804a972e79
parent 1670 de1ea3b2cfc4
permissions -rw-r--r--
Move buildbot script changes to stable-3.0 branch.
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
1670
de1ea3b2cfc4 cmake: Minimum CMake version is now 2.8.12.
Ryan C. Gordon <icculus@icculus.org>
parents: 1669
diff changeset
    12
cmake_minimum_required(VERSION 2.8.12)
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)
1666
fcdfd7e3d4d7 Bumped version to 3.0.2!
Ryan C. Gordon <icculus@icculus.org>
parents: 1656
diff changeset
    15
set(PHYSFS_VERSION 3.0.2)
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
1588
59a7ec36bd8c qnx: Added more proper support for QNX.
Ryan C. Gordon <icculus@icculus.org>
parents: 1587
diff changeset
    78
    src/physfs_platform_qnx.c
1506
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    79
    src/physfs_archiver_dir.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    80
    src/physfs_archiver_unpacked.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    81
    src/physfs_archiver_grp.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    82
    src/physfs_archiver_hog.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    83
    src/physfs_archiver_7z.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    84
    src/physfs_archiver_mvl.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    85
    src/physfs_archiver_qpak.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    86
    src/physfs_archiver_wad.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    87
    src/physfs_archiver_zip.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    88
    src/physfs_archiver_slb.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    89
    src/physfs_archiver_iso9660.c
c9d568ce4ed1 Renamed all the sources to start with "physfs_"
Ryan C. Gordon <icculus@icculus.org>
parents: 1505
diff changeset
    90
    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
    91
    ${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
    92
    ${PHYSFS_M_SRCS}
798
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
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    96
# Archivers ...
1438
73b219f512c0 The archiver options in the CMake file should disable, not enable.
Ryan C. Gordon <icculus@icculus.org>
parents: 1437
diff changeset
    97
# 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
    98
#  disabling them.
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    99
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   100
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
   101
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
   102
    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
   103
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   104
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   105
option(PHYSFS_ARCHIVE_7Z "Enable 7zip support" TRUE)
1467
75091b2a2a94 Rewrote the 7zip archiver.
Ryan C. Gordon <icculus@icculus.org>
parents: 1450
diff changeset
   106
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
   107
    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
   108
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   109
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   110
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
   111
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
   112
    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
   113
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   115
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
   116
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
   117
    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
   118
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   119
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   120
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
   121
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
   122
    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
   123
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   125
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
   126
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
   127
    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
   128
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   130
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
   131
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
   132
    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
   133
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   134
1315
c686e4f84ab5 SLB archiver
Aleksi Nurmi <aleksi.nurmi@gmail.com>
parents: 1311
diff changeset
   135
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
   136
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
   137
    add_definitions(-DPHYSFS_SUPPORTS_SLB=0)
1315
c686e4f84ab5 SLB archiver
Aleksi Nurmi <aleksi.nurmi@gmail.com>
parents: 1311
diff changeset
   138
endif()
c686e4f84ab5 SLB archiver
Aleksi Nurmi <aleksi.nurmi@gmail.com>
parents: 1311
diff changeset
   139
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   140
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
   141
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
   142
    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
   143
endif()
1066
e1d83e3b5d32 Make ISO9660 archiver optional.
Ryan C. Gordon <icculus@icculus.org>
parents: 1064
diff changeset
   144
1391
06aa5aca8518 Add support for VDF
Francesco Bertolaccini <bertolaccinifrancesco@gmail.com>
parents: 1338
diff changeset
   145
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
   146
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
   147
    add_definitions(-DPHYSFS_SUPPORTS_VDF=0)
1391
06aa5aca8518 Add support for VDF
Francesco Bertolaccini <bertolaccinifrancesco@gmail.com>
parents: 1338
diff changeset
   148
endif()
06aa5aca8518 Add support for VDF
Francesco Bertolaccini <bertolaccinifrancesco@gmail.com>
parents: 1338
diff changeset
   149
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   151
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
   152
if(PHYSFS_BUILD_STATIC)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   153
    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
   154
    # 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
   155
    #  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
   156
    #  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
   157
    #  Windows can just have a separate name.
1598
c0f940da618c Allow physfs.pc generation on mingw-w64 and osx homebrew/etc,
Marty Plummer <netz.kernel@gmail.com>
parents: 1588
diff changeset
   158
    if(NOT MSVC)
1436
c18e307b5fc3 Don't rename the static library on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents: 1435
diff changeset
   159
        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
   160
    endif()
1519
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
   161
    if(WINRT)
1521
0b052d88ca0d WinRT: Disable harmless (in our case) linker warning.
Ryan C. Gordon <icculus@icculus.org>
parents: 1519
diff changeset
   162
        # 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
   163
		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
   164
        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
   165
    endif()
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
   166
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   167
    set(PHYSFS_LIB_TARGET physfs-static)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   168
    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
   169
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   170
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   171
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
   172
if(PHYSFS_BUILD_SHARED)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   173
    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
   174
    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
   175
    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
   176
    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
   177
    if(WINRT)
3edf28828371 Fixed building for WinRT via CMake.
Ryan C. Gordon <icculus@icculus.org>
parents: 1518
diff changeset
   178
		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
   179
    endif()
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   180
    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
   181
    set(PHYSFS_LIB_TARGET physfs)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   182
    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
   183
endif()
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   184
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   185
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
   186
    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
   187
endif()
802
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   188
d04103af68a5 Can now build shared or static (or both) libraries.
Ryan C. Gordon <icculus@icculus.org>
parents: 801
diff changeset
   189
# 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
   190
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
   191
    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
   192
    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
   193
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   194
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   195
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
   196
mark_as_advanced(PHYSFS_BUILD_TEST)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   197
if(PHYSFS_BUILD_TEST)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   198
    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
   199
    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
   200
    if(READLINE_H AND HISTORY_H)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   201
        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
   202
        set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARY})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   203
        find_library(READLINE_LIBRARY readline)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   204
        if(READLINE_LIBRARY)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   205
            set(HAVE_SYSTEM_READLINE TRUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   206
            set(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY})
1606
4b3c2995ce0f cmake: mark readline include directories as SYSTEM (thanks, Tobias!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1598
diff changeset
   207
            include_directories(SYSTEM ${READLINE_H} ${HISTORY_H})
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   208
            add_definitions(-DPHYSFS_HAVE_READLINE=1)
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
    endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   211
    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
   212
    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
   213
    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
   214
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   215
1669
6ad125b6b379 CMake: made install step export the targets
Kevin d'Orange
parents: 1666
diff changeset
   216
install(TARGETS ${PHYSFS_INSTALL_TARGETS} EXPORT PhysFSExport
804
45c29325e017 Added install targets for "make install"
Ryan C. Gordon <icculus@icculus.org>
parents: 803
diff changeset
   217
        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
   218
        LIBRARY DESTINATION lib${LIB_SUFFIX}
1669
6ad125b6b379 CMake: made install step export the targets
Kevin d'Orange
parents: 1666
diff changeset
   219
        ARCHIVE DESTINATION lib${LIB_SUFFIX}
6ad125b6b379 CMake: made install step export the targets
Kevin d'Orange
parents: 1666
diff changeset
   220
        INCLUDES DESTINATION include)
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   221
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
   222
1669
6ad125b6b379 CMake: made install step export the targets
Kevin d'Orange
parents: 1666
diff changeset
   223
install(EXPORT PhysFSExport
6ad125b6b379 CMake: made install step export the targets
Kevin d'Orange
parents: 1666
diff changeset
   224
        DESTINATION "lib${LIB_SUFFIX}/cmake/PhysFS"
6ad125b6b379 CMake: made install step export the targets
Kevin d'Orange
parents: 1666
diff changeset
   225
        FILE PhysFSConfig.cmake
6ad125b6b379 CMake: made install step export the targets
Kevin d'Orange
parents: 1666
diff changeset
   226
)
6ad125b6b379 CMake: made install step export the targets
Kevin d'Orange
parents: 1666
diff changeset
   227
6ad125b6b379 CMake: made install step export the targets
Kevin d'Orange
parents: 1666
diff changeset
   228
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   229
find_package(Doxygen)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   230
if(DOXYGEN_FOUND)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   231
    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
   232
    configure_file(
1153
5cbedebaa623 Corrected doc paths for development branch.
Ryan C. Gordon <icculus@icculus.org>
parents: 1152
diff changeset
   233
        "${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
   234
        "${PHYSFS_OUTPUT_DOXYFILE}"
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   235
        COPYONLY
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   236
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   237
    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
   238
    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
   239
    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
   240
    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
   241
1656
f875d02b9d41 cmake: Special build target names ("dist" "docs" "uninstall") can be renamed.
Ryan C. Gordon <icculus@icculus.org>
parents: 1627
diff changeset
   242
    set(PHYSFS_TARGETNAME_DOCS "docs" CACHE STRING "Name of 'docs' build target")
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   243
    add_custom_target(
1656
f875d02b9d41 cmake: Special build target names ("dist" "docs" "uninstall") can be renamed.
Ryan C. Gordon <icculus@icculus.org>
parents: 1627
diff changeset
   244
        ${PHYSFS_TARGETNAME_DOCS}
1151
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   245
        ${DOXYGEN_EXECUTABLE} "${PHYSFS_OUTPUT_DOXYFILE}"
a9e1bbe6e8d6 Fixed "make docs" for out-of-tree builds.
Ryan C. Gordon <icculus@icculus.org>
parents: 1140
diff changeset
   246
        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
   247
        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
   248
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   249
else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   250
    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
   251
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   252
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   253
if(UNIX)
1310
3382edc8a7f9 Use .tar.bz2 on this branch, too.
Ryan C. Gordon <icculus@icculus.org>
parents: 1309
diff changeset
   254
    set(PHYSFS_TARBALL "${CMAKE_CURRENT_SOURCE_DIR}/../physfs-${PHYSFS_VERSION}.tar.bz2")
1656
f875d02b9d41 cmake: Special build target names ("dist" "docs" "uninstall") can be renamed.
Ryan C. Gordon <icculus@icculus.org>
parents: 1627
diff changeset
   255
f875d02b9d41 cmake: Special build target names ("dist" "docs" "uninstall") can be renamed.
Ryan C. Gordon <icculus@icculus.org>
parents: 1627
diff changeset
   256
    set(PHYSFS_TARGETNAME_DIST "dist" CACHE STRING "Name of 'dist' build target")
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   257
    add_custom_target(
1656
f875d02b9d41 cmake: Special build target names ("dist" "docs" "uninstall") can be renamed.
Ryan C. Gordon <icculus@icculus.org>
parents: 1627
diff changeset
   258
        ${PHYSFS_TARGETNAME_DIST}
1310
3382edc8a7f9 Use .tar.bz2 on this branch, too.
Ryan C. Gordon <icculus@icculus.org>
parents: 1309
diff changeset
   259
        hg archive -t tbz2 "${PHYSFS_TARBALL}"
1042
dc9291957a5a Fixed "make dist" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 1041
diff changeset
   260
        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
dc9291957a5a Fixed "make dist" target.
Ryan C. Gordon <icculus@icculus.org>
parents: 1041
diff changeset
   261
        COMMENT "Building source tarball '${PHYSFS_TARBALL}'..."
1041
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   262
    )
1656
f875d02b9d41 cmake: Special build target names ("dist" "docs" "uninstall") can be renamed.
Ryan C. Gordon <icculus@icculus.org>
parents: 1627
diff changeset
   263
f875d02b9d41 cmake: Special build target names ("dist" "docs" "uninstall") can be renamed.
Ryan C. Gordon <icculus@icculus.org>
parents: 1627
diff changeset
   264
    set(PHYSFS_TARGETNAME_UNINSTALL "uninstall" CACHE STRING "Name of 'uninstall' build target")
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   265
    add_custom_target(
1656
f875d02b9d41 cmake: Special build target names ("dist" "docs" "uninstall") can be renamed.
Ryan C. Gordon <icculus@icculus.org>
parents: 1627
diff changeset
   266
        ${PHYSFS_TARGETNAME_UNINSTALL}
1041
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   267
        "${CMAKE_CURRENT_SOURCE_DIR}/extras/uninstall.sh"
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   268
        WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   269
        COMMENT "Uninstall the project..."
f7b7996e54f1 Added uninstall target for Unix platforms.
Ryan C. Gordon <icculus@icculus.org>
parents: 1040
diff changeset
   270
    )
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   271
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   272
1598
c0f940da618c Allow physfs.pc generation on mingw-w64 and osx homebrew/etc,
Marty Plummer <netz.kernel@gmail.com>
parents: 1588
diff changeset
   273
if(NOT MSVC)
1338
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   274
    configure_file(
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   275
        "extras/physfs.pc.in"
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   276
        "extras/physfs.pc"
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   277
        @ONLY
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   278
    )
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   279
    install(
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   280
        FILES "${CMAKE_CURRENT_BINARY_DIR}/extras/physfs.pc"
1611
c31e8b2119eb CMake: Honor LIB_SUFFIX for pkgconfig install path
Rémi Verschelde <rverschelde@gmail.com>
parents: 1606
diff changeset
   281
        DESTINATION "lib${LIB_SUFFIX}/pkgconfig"
1338
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   282
    )
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   283
endif()
aae614cdd005 Added pkg-config support (thanks, Jonas!).
Ryan C. Gordon <icculus@icculus.org>
parents: 1318
diff changeset
   284
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   285
macro(message_bool_option _NAME _VALUE)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   286
    if(${_VALUE})
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   287
        message(STATUS "  ${_NAME}: enabled")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   288
    else()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   289
        message(STATUS "  ${_NAME}: disabled")
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   290
    endif()
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   291
endmacro()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   292
1309
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   293
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
   294
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
   295
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
   296
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
   297
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
   298
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
   299
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
   300
message_bool_option("QPAK support" PHYSFS_ARCHIVE_QPAK)
1315
c686e4f84ab5 SLB archiver
Aleksi Nurmi <aleksi.nurmi@gmail.com>
parents: 1311
diff changeset
   301
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
   302
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
   303
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
   304
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
   305
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
   306
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
   307
if(PHYSFS_BUILD_TEST)
df0609b72174 Lowercased most of the CMake project file.
Ryan C. Gordon <icculus@icculus.org>
parents: 1297
diff changeset
   308
    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
   309
endif()
798
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   310
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   311
# end of CMakeLists.txt ...
18455baab480 Moved to CMake!
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   312