Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 12, 2009, 2:34:05 PM (16 years ago)
Author:
rgrieder
Message:

Unix fix for the plugin finder: CMake always puts lib in front of the library name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem2/cmake/FindOGRE.cmake

    r2585 r2586  
    5151    SET(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
    5252ENDIF(WIN32)
     53SET(CMAKE_FIND_LIBRARY_PREFIXES_STORED ${CMAKE_FIND_LIBRARY_PREFIXES})
     54SET(CMAKE_FIND_LIBRARY_PREFIXES "")
     55
    5356SET(OGRE_RENDER_SYSTEM_FOUND FALSE)
    5457FOREACH(_plugin ${OGRE_PLUGINS})
    5558    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_OPTIMIZED
    5659        NAMES ${_plugin}
    57         PATHS $ENV{OGRE_HOME}
     60        PATHS $ENV{OGRE_HOME} /usr/local /usr
    5861        PATH_SUFFIXES lib lib/OGRE bin bin/Release bin/release Release release
    5962    )
     
    6568    # We only need at least one render system. Check at the end
    6669    IF(NOT ${_plugin} MATCHES "RenderSystem")
    67       SET(OGRE_PLUGIN_${_plugin}_FIND_REQUIRED TRUE)
    68     ELSE(NOT ${_plugin} MATCHES "RenderSystem")
    69       SET(OGRE_PLUGIN_${_plugin}_FIND_REQUIRED FALSE)
     70        IF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
     71            MESSAGE(FATAL_ERROR "Could not find OGRE plugin named ${_plugin}")
     72        ENDIF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
     73    ELSEIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
    7074      SET(OGRE_RENDER_SYSTEM_FOUND TRUE)
    7175    ENDIF(NOT ${_plugin} MATCHES "RenderSystem")
    72     FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGRE_PLUGIN_${_plugin}
    73         "Could not find OGRE plugin named ${_plugin}"
    74         OGRE_PLUGIN_${_plugin}_OPTIMIZED
    75     )
    7676
    77     # If debug version is not available, release will do as well
    78     IF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
    79         SET(OGRE_PLUGIN_${_plugin}_DEBUG ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} CACHE STRING "")
    80     ENDIF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
    81     MARK_AS_ADVANCED(OGRE_PLUGIN_${_plugin}_OPTIMIZED OGRE_PLUGIN_${_plugin}_DEBUG)
     77    IF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
     78        # If debug version is not available, release will do as well
     79        IF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
     80            SET(OGRE_PLUGIN_${_plugin}_DEBUG ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} CACHE STRING "")
     81        ENDIF(NOT OGRE_PLUGIN_${_plugin}_DEBUG)
     82        MARK_AS_ADVANCED(OGRE_PLUGIN_${_plugin}_OPTIMIZED OGRE_PLUGIN_${_plugin}_DEBUG)
    8283
    83     ### Set variables to configure orxonox.ini correctly afterwards in bin/ ###
    84     # Check and set the folders
    85     GET_FILENAME_COMPONENT(_release_folder ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} PATH)
    86     IF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
    87         MESSAGE(FATAL_ERROR "Ogre release plugins have to be in the same folder!")
    88     ENDIF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
    89     SET(OGRE_PLUGINS_FOLDER_RELEASE ${_release_folder})
    90     GET_FILENAME_COMPONENT(_debug_folder ${OGRE_PLUGIN_${_plugin}_DEBUG} PATH)
    91     IF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
    92         MESSAGE(FATAL_ERROR "Ogre debug plugins have to be in the same folder!")
    93     ENDIF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
    94     SET(OGRE_PLUGINS_FOLDER_DEBUG ${_debug_folder})
     84        ### Set variables to configure orxonox.ini correctly afterwards in bin/ ###
     85        # Check and set the folders
     86        GET_FILENAME_COMPONENT(_release_folder ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} PATH)
     87        IF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
     88            MESSAGE(FATAL_ERROR "Ogre release plugins have to be in the same folder!")
     89        ENDIF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _release_folder)
     90        SET(OGRE_PLUGINS_FOLDER_RELEASE ${_release_folder})
     91        GET_FILENAME_COMPONENT(_debug_folder ${OGRE_PLUGIN_${_plugin}_DEBUG} PATH)
     92        IF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
     93            MESSAGE(FATAL_ERROR "Ogre debug plugins have to be in the same folder!")
     94        ENDIF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _debug_folder)
     95        SET(OGRE_PLUGINS_FOLDER_DEBUG ${_debug_folder})
    9596
    96     # Create a list with the plugins for relase and debug configurations
    97     LIST(APPEND OGRE_PLUGINS_RELEASE ${_plugin})
    98     IF(OGRE_PLUGIN_${_plugin}_DEBUG)
    99         LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin}${LIBRARY_DEBUG_POSTFIX})
    100     ELSE(OGRE_PLUGIN_${_plugin}_DEBUG)
    101         LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin})
    102     ENDIF(OGRE_PLUGIN_${_plugin}_DEBUG)
     97        # Create a list with the plugins for relase and debug configurations
     98        LIST(APPEND OGRE_PLUGINS_RELEASE ${_plugin})
     99        IF(OGRE_PLUGIN_${_plugin}_DEBUG)
     100            LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin}${LIBRARY_DEBUG_POSTFIX})
     101        ELSE(OGRE_PLUGIN_${_plugin}_DEBUG)
     102            LIST(APPEND OGRE_PLUGINS_DEBUG ${_plugin})
     103        ENDIF(OGRE_PLUGIN_${_plugin}_DEBUG)
     104    ENDIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
    103105ENDFOREACH(_plugin)
    104106IF(NOT OGRE_RENDER_SYSTEM_FOUND)
     
    109111    SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_STORED})
    110112ENDIF(WIN32)
     113SET(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES_STORED})
    111114
    112115# List has to be comma separated for orxonox.ini
Note: See TracChangeset for help on using the changeset viewer.