Fixed CMakeLists.txt to properly handle cross-compiling (thanks, Marc!).
This commit is contained in:
parent
44f6c8306d
commit
71e0e6883d
|
@ -272,26 +272,21 @@ ENDIF(PHYSFS_ARCHIVE_QPAK)
|
|||
# See if some archiver required zlib, and see about using system version.
|
||||
|
||||
IF(PHYSFS_NEED_ZLIB)
|
||||
CHECK_INCLUDE_FILE(zlib.h HAVE_ZLIB_H)
|
||||
IF(HAVE_ZLIB_H)
|
||||
CHECK_LIBRARY_EXISTS("z" "inflate" "" HAVE_LIBZ)
|
||||
IF(HAVE_LIBZ)
|
||||
SET(HAVE_SYSTEM_ZLIB TRUE)
|
||||
ENDIF(HAVE_LIBZ)
|
||||
ENDIF(HAVE_ZLIB_H)
|
||||
FIND_PACKAGE(ZLIB)
|
||||
|
||||
IF(HAVE_SYSTEM_ZLIB)
|
||||
IF(ZLIB_FOUND)
|
||||
OPTION(PHYSFS_INTERNAL_ZLIB "Link own zlib instead of system library" FALSE)
|
||||
ELSE(HAVE_SYSTEM_ZLIB)
|
||||
SET(PHYSFS_INTERNAL_ZLIB TRUE)
|
||||
ENDIF(HAVE_SYSTEM_ZLIB)
|
||||
ENDIF(ZLIB_FOUND)
|
||||
|
||||
IF(PHYSFS_INTERNAL_ZLIB)
|
||||
INCLUDE_DIRECTORIES(zlib123)
|
||||
ADD_DEFINITIONS(-DZ_PREFIX=1)
|
||||
SET(PHYSFS_SRCS ${PHYSFS_SRCS} ${ZLIB_SRCS})
|
||||
ELSE(PHYSFS_INTERNAL_ZLIB)
|
||||
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} z)
|
||||
SET(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${ZLIB_LIBRARY})
|
||||
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
|
||||
ENDIF(PHYSFS_INTERNAL_ZLIB)
|
||||
ENDIF(PHYSFS_NEED_ZLIB)
|
||||
|
||||
|
@ -326,18 +321,19 @@ ENDIF(PHYSFS_BUILD_SHARED AND PHYSFS_BUILD_STATIC)
|
|||
OPTION(PHYSFS_BUILD_TEST "Build stdio test program." TRUE)
|
||||
MARK_AS_ADVANCED(PHYSFS_BUILD_TEST)
|
||||
IF(PHYSFS_BUILD_TEST)
|
||||
CHECK_INCLUDE_FILE(readline/readline.h HAVE_READLINE_H)
|
||||
CHECK_INCLUDE_FILE(readline/history.h HAVE_HISTORY_H)
|
||||
IF(HAVE_READLINE_H AND HAVE_HISTORY_H)
|
||||
FIND_PATH(READLINE_H readline/readline.h)
|
||||
FIND_PATH(HISTORY_H readline/history.h)
|
||||
IF(READLINE_H AND HISTORY_H)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES curses)
|
||||
CHECK_LIBRARY_EXISTS("readline" "readline" "" HAVE_LIBREADLINE)
|
||||
CHECK_LIBRARY_EXISTS("readline" "history" "" HAVE_LIBHISTORY)
|
||||
IF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY)
|
||||
FIND_LIBRARY(READLINE_LIBRARY readline)
|
||||
FIND_LIBRARY(HISTORY_LIBRARY history)
|
||||
IF(READLINE_LIBRARY AND HISTORY_LIBRARY)
|
||||
SET(HAVE_SYSTEM_READLINE TRUE)
|
||||
SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} " " readline curses)
|
||||
SET(TEST_PHYSFS_LIBS ${TEST_PHYSFS_LIBS} ${READLINE_LIBRARY} ${CURSES_LIBRARY})
|
||||
INCLUDE_DIRECTORIES(${READLINE_H} ${HISTORY_H})
|
||||
ADD_DEFINITIONS(-DPHYSFS_HAVE_READLINE=1)
|
||||
ENDIF(HAVE_LIBREADLINE AND HAVE_LIBHISTORY)
|
||||
ENDIF(HAVE_READLINE_H AND HAVE_HISTORY_H)
|
||||
ENDIF(READLINE_LIBRARY AND HISTORY_LIBRARY)
|
||||
ENDIF(READLINE_H AND HISTORY_H)
|
||||
ADD_EXECUTABLE(test_physfs test/test_physfs.c)
|
||||
TARGET_LINK_LIBRARIES(test_physfs ${PHYSFS_LIB_TARGET} ${TEST_PHYSFS_LIBS} ${OTHER_LDFLAGS})
|
||||
SET(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
|
||||
|
|
Loading…
Reference in New Issue