CMakeLists.txt
changeset 802 d04103af68a5
parent 801 a6d25b52f2c7
child 803 4b1e0994ab97
equal deleted inserted replaced
801:a6d25b52f2c7 802:d04103af68a5
   229     ELSE(PHYSFS_INTERNAL_ZLIB)
   229     ELSE(PHYSFS_INTERNAL_ZLIB)
   230         SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} z)
   230         SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} z)
   231     ENDIF(PHYSFS_INTERNAL_ZLIB)
   231     ENDIF(PHYSFS_INTERNAL_ZLIB)
   232 ENDIF(PHYSFS_NEED_ZLIB)
   232 ENDIF(PHYSFS_NEED_ZLIB)
   233 
   233 
   234 
   234 OPTION(PHYSFS_BUILD_STATIC "Build static library" TRUE)
   235 
   235 IF(PHYSFS_BUILD_STATIC)
   236 ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS})
   236     ADD_LIBRARY(physfs-static STATIC ${PHYSFS_SRCS})
   237 TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
   237     SET_TARGET_PROPERTIES(physfs-static PROPERTIES OUTPUT_NAME "physfs")
       
   238     SET(PHYSFS_LIB_TARGET physfs-static)
       
   239 ENDIF(PHYSFS_BUILD_STATIC)
       
   240 
       
   241 OPTION(PHYSFS_BUILD_SHARED "Build shared library" TRUE)
       
   242 IF(PHYSFS_BUILD_SHARED)
       
   243     ADD_LIBRARY(physfs SHARED ${PHYSFS_SRCS})
       
   244     TARGET_LINK_LIBRARIES(physfs ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
       
   245     SET(PHYSFS_LIB_TARGET physfs)
       
   246 ENDIF(PHYSFS_BUILD_SHARED)
       
   247 
       
   248 IF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
       
   249     MESSAGE(FATAL "Both shared and static libraries are disabled!")
       
   250 ENDIF(NOT PHYSFS_BUILD_SHARED AND NOT PHYSFS_BUILD_STATIC)
       
   251 
       
   252 # CMake FAQ says I need this...
       
   253 IF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
       
   254     SET_TARGET_PROPERTIES(physfs PROPERTIES CLEAN_DIRECT_OUTPUT 1)
       
   255     SET_TARGET_PROPERTIES(physfs-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
       
   256 ENDIF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
   238 
   257 
   239 OPTION(PHYSFS_BUILD_TEST "Build test program." TRUE)
   258 OPTION(PHYSFS_BUILD_TEST "Build test program." TRUE)
   240 MARK_AS_ADVANCED(PHYSFS_BUILD_TEST)
   259 MARK_AS_ADVANCED(PHYSFS_BUILD_TEST)
   241 IF(PHYSFS_BUILD_TEST)
   260 IF(PHYSFS_BUILD_TEST)
   242     CHECK_INCLUDE_FILE(readline/readline.h HAVE_READLINE_H)
   261     CHECK_INCLUDE_FILE(readline/readline.h HAVE_READLINE_H)
   250             SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} " " readline curses)
   269             SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} " " readline curses)
   251             ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1)
   270             ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1)
   252         ENDIF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY)
   271         ENDIF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY)
   253     ENDIF(HAVE_READLINE_H AND HAVE_HISTORY_H)
   272     ENDIF(HAVE_READLINE_H AND HAVE_HISTORY_H)
   254     ADD_EXECUTABLE(test_physfs test/test_physfs.c)
   273     ADD_EXECUTABLE(test_physfs test/test_physfs.c)
   255     TARGET_LINK_LIBRARIES(test_physfs physfs ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
   274     TARGET_LINK_LIBRARIES(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
   256 ENDIF(PHYSFS_BUILD_TEST)
   275 ENDIF(PHYSFS_BUILD_TEST)
   257 
   276 
   258 FIND_PACKAGE(Doxygen)
   277 FIND_PACKAGE(Doxygen)
   259 IF(DOXYGEN_FOUND)
   278 IF(DOXYGEN_FOUND)
   260     ADD_CUSTOM_TARGET(docs ${DOXYGEN_EXECUTABLE} COMMENT "Building documentation")
   279     ADD_CUSTOM_TARGET(docs ${DOXYGEN_EXECUTABLE} COMMENT "Building documentation")
   280 MESSAGE_BOOL_OPTION("MVL support" PHYSFS_ARCHIVE_MVL)
   299 MESSAGE_BOOL_OPTION("MVL support" PHYSFS_ARCHIVE_MVL)
   281 MESSAGE_BOOL_OPTION("QPAK support" PHYSFS_ARCHIVE_QPAK)
   300 MESSAGE_BOOL_OPTION("QPAK support" PHYSFS_ARCHIVE_QPAK)
   282 MESSAGE_BOOL_OPTION("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT)
   301 MESSAGE_BOOL_OPTION("CD-ROM drive support" PHYSFS_HAVE_CDROM_SUPPORT)
   283 MESSAGE_BOOL_OPTION("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT)
   302 MESSAGE_BOOL_OPTION("Thread safety" PHYSFS_HAVE_THREAD_SUPPORT)
   284 MESSAGE_BOOL_OPTION("Build own zlib" PHYSFS_INTERNAL_ZLIB)
   303 MESSAGE_BOOL_OPTION("Build own zlib" PHYSFS_INTERNAL_ZLIB)
       
   304 MESSAGE_BOOL_OPTION("Build static library" PHYSFS_BUILD_STATIC)
       
   305 MESSAGE_BOOL_OPTION("Build shared library" PHYSFS_BUILD_SHARED)
   285 MESSAGE_BOOL_OPTION("Build test program" PHYSFS_BUILD_TEST)
   306 MESSAGE_BOOL_OPTION("Build test program" PHYSFS_BUILD_TEST)
   286 IF(PHYSFS_BUILD_TEST)
   307 IF(PHYSFS_BUILD_TEST)
   287     MESSAGE_BOOL_OPTION("  Use readline in test program" HAVE_SYSTEM_READLINE)
   308     MESSAGE_BOOL_OPTION("  Use readline in test program" HAVE_SYSTEM_READLINE)
   288 ENDIF(PHYSFS_BUILD_TEST)
   309 ENDIF(PHYSFS_BUILD_TEST)
   289 
   310