diff --git a/code/CMakeModules/FindFMOD.cmake b/code/CMakeModules/FindFMOD.cmake index b28f77b1e..3bdd09e8f 100644 --- a/code/CMakeModules/FindFMOD.cmake +++ b/code/CMakeModules/FindFMOD.cmake @@ -1,57 +1,9 @@ -# - Locate FMOD library -# This module defines -# FMOD_LIBRARY, the library to link against -# FMOD_FOUND, if false, do not try to link to FMOD -# FMOD_INCLUDE_DIR, where to find headers. - -IF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR) - # in cache already - SET(FMOD_FIND_QUIETLY TRUE) -ENDIF() - - -FIND_PATH(FMOD_INCLUDE_DIR - fmod.h - PATHS - $ENV{FMOD_DIR}/include - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include - PATH_SUFFIXES fmod fmod3 -) +INCLUDE(FindHelpers) IF(TARGET_X64) - SET(FMOD_LIBRARY_NAMES fmod64 fmod) + SET(FMOD_BASE fmod64) ELSE() - SET(FMOD_LIBRARY_NAMES fmodvc fmod) + SET(FMOD_BASE fmodvc) ENDIF() -FIND_LIBRARY(FMOD_LIBRARY - NAMES - ${FMOD_LIBRARY_NAMES} - PATHS - $ENV{FMOD_DIR}/lib - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 -) - -IF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR) - SET(FMOD_FOUND "YES") - IF(NOT FMOD_FIND_QUIETLY) - MESSAGE(STATUS "Found FMOD: ${FMOD_LIBRARY}") - ENDIF() -ELSE() - IF(NOT FMOD_FIND_QUIETLY) - MESSAGE(STATUS "Warning: Unable to find FMOD!") - ENDIF() -ENDIF() +FIND_PACKAGE_HELPER(FMOD fmod.h RELEASE ${FMOD_BASE} DEBUG ${FMOD_BASE}d SUFFIXES fmod3) diff --git a/code/CMakeModules/FindLuabind.cmake b/code/CMakeModules/FindLuabind.cmake index 5511379a3..dae1dbd99 100644 --- a/code/CMakeModules/FindLuabind.cmake +++ b/code/CMakeModules/FindLuabind.cmake @@ -3,6 +3,7 @@ # LUABIND_LIBRARIES, the libraries to link against # LUABIND_FOUND, if false, do not try to link to LUABIND # LUABIND_INCLUDE_DIR, where to find headers. +INCLUDE(FindHelpers) MACRO(FIND_CORRECT_LUA_VERSION) # Check Lua version linked to Luabind under Linux @@ -85,18 +86,6 @@ IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR) SET(Luabind_FIND_QUIETLY TRUE) ENDIF() -FIND_PATH(LUABIND_INCLUDE_DIR - luabind/luabind.hpp - PATHS - $ENV{LUABIND_DIR}/include - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include -) - SET(LIBRARY_NAME_RELEASE) SET(LIBRARY_NAME_DEBUG) @@ -149,35 +138,7 @@ ENDIF() LIST(APPEND LIBRARY_NAME_RELEASE luabind libluabind) LIST(APPEND LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd) -FIND_LIBRARY(LUABIND_LIBRARY_RELEASE - NAMES ${LIBRARY_NAME_RELEASE} - PATHS - $ENV{LUABIND_DIR}/lib - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 -) - -FIND_LIBRARY(LUABIND_LIBRARY_DEBUG - NAMES ${LIBRARY_NAME_DEBUG} - PATHS - $ENV{LUABIND_DIR}/lib - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 -) +FIND_PACKAGE_HELPER(Luabind luabind/luabind.hpp RELEASE ${LIBRARY_NAME_RELEASE} DEBUG ${LIBRARY_NAME_DEBUG}) FIND_PACKAGE(Boost REQUIRED) diff --git a/code/CMakeModules/FindOgg.cmake b/code/CMakeModules/FindOgg.cmake index c1f4492e1..aa2f9164c 100644 --- a/code/CMakeModules/FindOgg.cmake +++ b/code/CMakeModules/FindOgg.cmake @@ -1,49 +1,3 @@ -# - Locate Ogg library -# This module defines -# OGG_LIBRARY, the library to link against -# OGG_FOUND, if false, do not try to link to OGG -# OGG_INCLUDE_DIR, where to find headers. +INCLUDE(FindHelpers) -IF(OGG_LIBRARY AND OGG_INCLUDE_DIR) - # in cache already - SET(OGG_FIND_QUIETLY TRUE) -ENDIF() - - -FIND_PATH(OGG_INCLUDE_DIR - ogg/ogg.h - PATHS - $ENV{OGG_DIR}/include - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include -) - -FIND_LIBRARY(OGG_LIBRARY - NAMES ogg libogg - PATHS - $ENV{OGG_DIR}/lib - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 -) - -IF(OGG_LIBRARY AND OGG_INCLUDE_DIR) - SET(OGG_FOUND "YES") - IF(NOT OGG_FIND_QUIETLY) - MESSAGE(STATUS "Found Ogg: ${OGG_LIBRARY}") - ENDIF() -ELSE() - IF(NOT OGG_FIND_QUIETLY) - MESSAGE(STATUS "Warning: Unable to find Ogg!") - ENDIF() -ENDIF() +FIND_PACKAGE_HELPER(Ogg ogg/ogg.h) diff --git a/code/CMakeModules/FindSTLport.cmake b/code/CMakeModules/FindSTLport.cmake index 68e542ea5..3b1cc1800 100644 --- a/code/CMakeModules/FindSTLport.cmake +++ b/code/CMakeModules/FindSTLport.cmake @@ -1,91 +1,5 @@ -# Look for a directory containing STLport. -# -# The following values are defined -# STLPORT_INCLUDE_DIR - where to find vector, etc. -# STLPORT_LIBRARIES - link against these to use STLport -# STLPORT_FOUND - True if the STLport is available. +INCLUDE(FindHelpers) -# also defined, but not for general use are -IF(STLPORT_LIBRARIES AND STLPORT_INCLUDE_DIR) - # in cache already - SET(STLPORT_FIND_QUIETLY TRUE) -ENDIF() - -FIND_PATH(STLPORT_INCLUDE_DIR - iostream - PATHS - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include - PATH_SUFFIXES stlport -) - -FIND_LIBRARY(STLPORT_LIBRARY_DEBUG - NAMES - stlport_cygwin_debug - stlport_cygwin_stldebug - stlport_gcc_debug - stlport_gcc_stldebug - stlportstld_x - stlportstld_x.5.2 - stlportd - stlportd_statix - stlportd_static - PATHS - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 -) - -FIND_LIBRARY(STLPORT_LIBRARY_RELEASE - NAMES - stlport_cygwin - stlport_gcc - stlport - stlport_x - stlport_x.5.2 - stlport_statix - stlport_static - PATHS - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 -) - -IF(STLPORT_INCLUDE_DIR) - IF(STLPORT_LIBRARY_RELEASE) - SET(STLPORT_FOUND TRUE) - - SET(STLPORT_LIBRARIES ${STLPORT_LIBRARY_RELEASE}) - IF(STLPORT_LIBRARY_DEBUG) - SET(STLPORT_LIBRARIES optimized ${STLPORT_LIBRARIES} debug ${STLPORT_LIBRARY_DEBUG}) - ENDIF() - ENDIF() -ENDIF() - -IF(STLPORT_FOUND) - IF(NOT STLPORT_FIND_QUIETLY) - MESSAGE(STATUS "Found STLport: ${STLPORT_LIBRARIES}") - ENDIF() -ELSE() - IF(NOT STLPORT_FIND_QUIETLY) - MESSAGE(STATUS "Warning: Unable to find STLport!") - ENDIF() -ENDIF() - -MARK_AS_ADVANCED(STLPORT_LIBRARY_RELEASE STLPORT_LIBRARY_DEBUG) +FIND_PACKAGE_HELPER(STLport iostream + RELEASE stlport_cygwin stlport_gcc stlport_x stlport_x.5.2 stlport_statix stlport_static + DEBUG stlport_cygwin_debug stlport_cygwin_stldebug stlport_gcc_debug stlport_gcc_stldebug stlportstld_x stlportstld_x.5.2 stlportd_statix stlportd_static) diff --git a/code/CMakeModules/FindSquish.cmake b/code/CMakeModules/FindSquish.cmake index 4242f4055..9d0928f87 100644 --- a/code/CMakeModules/FindSquish.cmake +++ b/code/CMakeModules/FindSquish.cmake @@ -1,69 +1,6 @@ -# -# Find the LibSquish includes and library -# -# This module defines -# SQUISH_INCLUDE_DIR, where to find squish.h -# SQUISH_LIBRARIES, where to find the Squish libraries. -# SQUISH_FOUND, If false, do not try to use Squish. +INCLUDE(FindHelpers) -# also defined, but not for general use are -IF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR) - # in cache already - SET(SQUISH_FIND_QUIETLY TRUE) -ENDIF() - -FIND_PATH(SQUISH_INCLUDE_DIR - squish.h - PATHS - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include - PATH_SUFFIXES cppunit -) - -FIND_LIBRARY(SQUISH_LIBRARY_RELEASE - squish - PATHS - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 -) - -FIND_LIBRARY(SQUISH_LIBRARY_DEBUG - squishd - PATHS - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 -) - -IF(SQUISH_INCLUDE_DIR) - IF(SQUISH_LIBRARY_RELEASE) - SET(SQUISH_FOUND "YES") - SET(SQUISH_LIBRARIES "optimized;${SQUISH_LIBRARY_RELEASE}") - IF(SQUISH_LIBRARY_DEBUG) - SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_DEBUG}") - ELSE() - SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_RELEASE}") - MESSAGE("Debug Squish NOT found, using the release version!") - ENDIF() - ENDIF() -ENDIF() +FIND_PACKAGE_HELPER(Squish squish.h) IF(SQUISH_FOUND) IF(NOT SQUISH_FIND_QUIETLY) @@ -74,10 +11,4 @@ IF(SQUISH_FOUND) SET(SQUISH_COMPRESS_HAS_METRIC ON) SET(SQUISH_DEFINITIONS -DSQUISH_COMPRESS_HAS_METRIC) ENDIF() -ELSE() - IF(NOT SQUISH_FIND_QUIETLY) - MESSAGE(STATUS "Warning: Unable to find Squish!") - ENDIF() ENDIF() - -MARK_AS_ADVANCED(SQUISH_LIBRARY_RELEASE SQUISH_LIBRARY_DEBUG) diff --git a/code/CMakeModules/FindVorbis.cmake b/code/CMakeModules/FindVorbis.cmake index 234d2d31a..b0a4ec2a6 100644 --- a/code/CMakeModules/FindVorbis.cmake +++ b/code/CMakeModules/FindVorbis.cmake @@ -1,65 +1,8 @@ -# - Locate Vorbis library -# This module defines -# VORBIS_LIBRARY, the library to link against -# VORBIS_FOUND, if false, do not try to link to VORBIS -# VORBIS_INCLUDE_DIR, where to find headers. +INCLUDE(FindHelpers) -IF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR) - # in cache already - SET(VORBIS_FIND_QUIETLY TRUE) -ENDIF() - - -FIND_PATH(VORBIS_INCLUDE_DIR - vorbis/vorbisfile.h - PATHS - $ENV{VORBIS_DIR}/include - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include -) - -FIND_LIBRARY(VORBIS_LIBRARY - NAMES vorbis libvorbis - PATHS - $ENV{VORBIS_DIR}/lib - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 -) - -FIND_LIBRARY(VORBISFILE_LIBRARY - NAMES vorbisfile libvorbisfile - PATHS - $ENV{VORBIS_DIR}/lib - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 -) +FIND_PACKAGE_HELPER(Vorbis vorbisenc.h) +FIND_PACKAGE_HELPER(VorbisFile vorbisfile.h SUFFIXES vorbis) -IF(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR) - SET(VORBIS_FOUND "YES") - SET(VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY}) - IF(NOT VORBIS_FIND_QUIETLY) - MESSAGE(STATUS "Found Vorbis: ${VORBIS_LIBRARY}") - ENDIF() -ELSE() - IF(NOT VORBIS_FIND_QUIETLY) - MESSAGE(STATUS "Warning: Unable to find Vorbis!") - ENDIF() +IF(VORBISFILE_FOUND) + SET(VORBIS_LIBRARIES ${VORBIS_LIBRARIES} ${VORBISFILE_LIBRARIES}) ENDIF()