Commits

Techwolf committed e7d0d54

Clean up and rework FMOD.cmake and FindFMOD.cmake
FMOD.cmake:
Move include(Prebuilt) to prebuilt section. It is only used for prebuilt anyway.
set(FMOD_FIND_REQUIRED ON) due to FMOD variable is use elsewhere in cmake files. This behaviour is the same as openal.
Remove redudent error messages and code due to above.
Rework the logic to be more cleaner.
Clean up whitespace.
FindFMOD.cmake
Remove redudent paths as cmake allready uses them as default. Use PATH_SUFFIXES instead.
The above will result in cmake looking in a lot more places and can handle custom build setups better.
Change FMOD to FMOD_FOUND. FMOD should not be change withen cmake.
Whitespace cleanup.

  • Participants
  • Parent commits 3b07f5e

Comments (0)

Files changed (2)

indra/cmake/FMOD.cmake

 # -*- cmake -*-
-include(Prebuilt)
 
-set(FMOD_FIND_QUIETLY OFF)
-set(FMOD_FIND_REQUIRED OFF)
-
-if (STANDALONE)
-  include(FindFMOD)
-else (STANDALONE)
-  use_prebuilt_binary(fmod)
-  
-  if (WINDOWS)
-    set(FMOD_LIBRARY fmod)
-  elseif (DARWIN)
-    set(FMOD_LIBRARY fmod)
-  elseif (LINUX)
-    set(FMOD_LIBRARY fmod-3.75)
-  endif (WINDOWS)
-  SET(FMOD_LIBRARIES ${FMOD_LIBRARY})
-  
-  set(FMOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
-endif (STANDALONE)
-
-if (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
-  set(FMOD ON CACHE BOOL "Use FMOD sound library.")
-else (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
-  set(FMOD_LIBRARY "")
-  set(FMOD_INCLUDE_DIR "")
-  if (FMOD)
-    message(STATUS "No support for FMOD audio found.")
-  endif (FMOD)
-  set(FMOD OFF CACHE BOOL "FMOD sound library not used.")
-endif (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
+set(FMOD ON CACHE BOOL "Use FMOD sound library.")
 
 if (FMOD)
-  message(STATUS "Building with FMOD audio support")
+  if (STANDALONE)
+    set(FMOD_FIND_REQUIRED ON)
+    include(FindFMOD)
+  else (STANDALONE)
+    include(Prebuilt)
+    use_prebuilt_binary(fmod)
+    
+    if (WINDOWS)
+      set(FMOD_LIBRARY fmod)
+    elseif (DARWIN)
+      set(FMOD_LIBRARY fmod)
+    elseif (LINUX)
+      set(FMOD_LIBRARY fmod-3.75)
+    endif (WINDOWS)
+
+    SET(FMOD_LIBRARIES ${FMOD_LIBRARY})
+    set(FMOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
+  endif (STANDALONE)
 endif (FMOD)

indra/cmake/FindFMOD.cmake

 # also defined, but not for general use are
 #  FMOD_LIBRARY, where to find the FMOD library.
 
-FIND_PATH(FMOD_INCLUDE_DIR fmod.h
-/usr/local/include/fmod
-/usr/local/include
-/usr/include/fmod
-/usr/include
-)
+FIND_PATH(FMOD_INCLUDE_DIR fmod.h PATH_SUFFIXES fmod)
 
-SET(FMOD_NAMES ${FMOD_NAMES} fmod fmodvc fmod-3.75)
 FIND_LIBRARY(FMOD_LIBRARY
-  NAMES ${FMOD_NAMES}
-  PATHS /usr/lib /usr/local/lib
+  NAMES fmod fmodvc fmod-3.75
+  PATH_SUFFIXES fmod
   )
 
 IF (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
-    SET(FMOD_LIBRARIES ${FMOD_LIBRARY})
-    SET(FMOD "YES")
+  SET(FMOD_LIBRARIES ${FMOD_LIBRARY})
+  SET(FMOD_FOUND "YES")
 ELSE (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
-  SET(FMOD "NO")
+  SET(FMOD_FOUND "NO")
 ENDIF (FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
 
-
-IF (FMOD)
-   IF (NOT FMOD_FIND_QUIETLY)
-      MESSAGE(STATUS "Found FMOD: ${FMOD_LIBRARIES}")
-   ENDIF (NOT FMOD_FIND_QUIETLY)
-ELSE (FMOD)
-   IF (FMOD_FIND_REQUIRED)
-      MESSAGE(FATAL_ERROR "Could not find FMOD library")
-   ENDIF (FMOD_FIND_REQUIRED)
-ENDIF (FMOD)
+IF (FMOD_FOUND)
+  IF (NOT FMOD_FIND_QUIETLY)
+    MESSAGE(STATUS "Found FMOD: ${FMOD_LIBRARIES}")
+  ENDIF (NOT FMOD_FIND_QUIETLY)
+ELSE (FMOD_FOUND)
+  IF (FMOD_FIND_REQUIRED)
+    MESSAGE(FATAL_ERROR "Could not find FMOD library")
+  ENDIF (FMOD_FIND_REQUIRED)
+ENDIF (FMOD_FOUND)
 
 # Deprecated declarations.
 SET (NATIVE_FMOD_INCLUDE_PATH ${FMOD_INCLUDE_DIR} )