summaryrefslogtreecommitdiff
path: root/Modules/FindPhysFS.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2005-07-13 09:06:26 -0400
committerBill Hoffman <bill.hoffman@kitware.com>2005-07-13 09:06:26 -0400
commit403959bc287e6398a63247bee67108a64729f4c7 (patch)
tree1ccc1c5fe5414c73dd5de050e1e5cd845e3764e1 /Modules/FindPhysFS.cmake
parent6571799492f9456ce35770b8e0b75de14d4bc0a2 (diff)
downloadcmake-403959bc287e6398a63247bee67108a64729f4c7.tar.gz
ENH: add a bunch of find sdl stuff from eric wing
Diffstat (limited to 'Modules/FindPhysFS.cmake')
-rw-r--r--Modules/FindPhysFS.cmake48
1 files changed, 48 insertions, 0 deletions
diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake
new file mode 100644
index 0000000000..d57d474f80
--- /dev/null
+++ b/Modules/FindPhysFS.cmake
@@ -0,0 +1,48 @@
+# Locate PhysFS library
+# This module defines
+# PHYSFS_LIBRARY, the name of the library to link against
+# PHYSFS_FOUND, if false, do not try to link to PHYSFS
+# PHYSFS_INCLUDE_DIR, where to find PHYSFS/PHYSFS.h
+#
+# $PHYSFSDIR is an environment variable that would
+# correspond to the ./configure --prefix=$PHYSFSDIR
+# used in building PHYSFS.
+#
+# Created by Eric Wing. This was influenced by the FindSDL.cmake
+# module, but with modifications to recognize OS X frameworks.
+
+# On OSX, this will prefer the Framework version (if found) over others.
+# People will have to manually change the cache values of
+# PHYSFS_LIBRARY to override this selection.
+FIND_PATH(PHYSFS_INCLUDE_DIR physfs.h
+ ~/Library/Frameworks/PhysFS.framework/Headers
+ /Library/Frameworks/PhysFS.framework/Headers
+ $ENV{PHYSFSDIR}/include
+ /usr/include
+ /usr/include/physfs
+ /usr/local/include/physfs
+ /sw/include
+ /sw/include/physfs
+ )
+# I'm not sure if I should do a special casing for Apple. It is
+# unlikely that other Unix systems will find the framework path.
+# But if they do ([Next|Open|GNU]Step?),
+# do they want the -framework option also?
+IF(${PHYSFS_INCLUDE_DIR} MATCHES ".framework")
+ SET (PHYSFS_LIBRARY "-framework PhysFS" CACHE STRING "PhysFS framework for OSX")
+ELSE(${PHYSFS_INCLUDE_DIR} MATCHES ".framework")
+ FIND_LIBRARY(PHYSFS_LIBRARY
+ NAMES physfs PhysFS
+ PATHS
+ $ENV{PHYSFSDIR}/lib
+ /usr/lib
+ /usr/local/lib
+ /sw/lib
+ )
+ENDIF(${PHYSFS_INCLUDE_DIR} MATCHES ".framework")
+
+SET(PHYSFS_FOUND "NO")
+IF(PHYSFS_LIBRARY)
+ SET(PHYSFS_FOUND "YES")
+ENDIF(PHYSFS_LIBRARY)
+