# - Find vrpn # Find the vrpn library. # # This module defines: # vrpn_FOUND - if false, you cannot use vrpn. # vrpn_DEFINITIONS - compile- and link-definitions for vrpn # vrpn_INCLUDE_DIR - the directory in which you can find vrpnAPI_CC.h # vrpn_INCLUDE_DIRS - the same as vrpn_INCLUDE_DIR # vrpn_LIBRARY - the full path of libvrpn # vrpn_LIBRARIES - the full path of libvrpn + names of libraries linked against # vrpn_LIBRARY_DIR - the directory containing libvrpn # vrpn_LIBRARY_DIRS - the library directories needed for vrpn_LIBRARIES # vrpn_FRAMEWORKS - the frameworks needed for vrpn (needed on MAC systems) # # To aid in the detection_process, you can set the following variables: # vrpn_ROOT_DIR - give a hint, which directory to use (=install prefix of vrpn) # if this is not set, the environment variable vrpn_ROOT_DIR is used, if available. # # Examples: # set ( vrpn_ROOT_DIR /usr/local ) # ############################################################################### # The following variables are used internally and unset after use: ############################################################################### # CHANGES: # - 14.10.2009 (rlander): created ############################################################################### # default paths for vrpn_ROOT_DIR set (vrpn_DEFAULT_PATHS /usr/local/vrpn CACHE INTERNAL "Default paths for vrpn_ROOT_DIR") # check for CMAKE 24 version if (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 4) set (CMAKE_VERSION_24 TRUE) endif (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 4) #make cache-entry: set ( vrpn_ROOT_DIR ${vrpn_ROOT_DIR} CACHE PATH "Install prefix of the vrpn library") # honor environment variables: if ( NOT vrpn_ROOT_DIR ) set ( vrpn_ROOT_DIR $ENV{vrpn_ROOT_DIR} ) endif ( NOT vrpn_ROOT_DIR ) ############################################################################### # find vrpn itself: ############################################################################### # try to find the root directory (if not set): if ( NOT vrpn_ROOT_DIR ) # CMAKE 2.4.x compatibility if ( CMAKE_VERSION_24 ) find_path( vrpn_FIND_ROOT_DIR NAMES include/vrpn/vrpn_Tracker.h PATHS ${vrpn_DEFAULT_PATHS} DOC "Helper for finding vrpn_ROOT_DIR") else ( CMAKE_VERSION_24 ) find_path( vrpn_FIND_ROOT_DIR NAMES include/vrpn/vrpn_Tracker.h HINTS ${vrpn_DEFAULT_PATHS} DOC "Helper for finding vrpn_ROOT_DIR") endif ( CMAKE_VERSION_24 ) if ( vrpn_FIND_ROOT_DIR ) set (vrpn_ROOT_DIR ${vrpn_FIND_ROOT_DIR} CACHE PATH "Install prefix of the vrpn library" FORCE) endif ( vrpn_FIND_ROOT_DIR ) MARK_AS_ADVANCED ( vrpn_FIND_ROOT_DIR ) endif ( NOT vrpn_ROOT_DIR ) # try to find the include directory: # CMAKE 2.4.x compatibility if ( CMAKE_VERSION_24 ) find_path( vrpn_INCLUDE_DIR NAMES vrpn/vrpn_Tracker.h PATHS ${vrpn_ROOT_DIR}/include DOC "The directory in which you can find vrpn/vrpn_Tracker.h" ) else ( CMAKE_VERSION_24 ) find_path( vrpn_INCLUDE_DIR NAMES vrpn/vrpn_Tracker.h HINTS ${vrpn_ROOT_DIR}/include DOC "The directory in which you can find vrpn/vrpn_Tracker.h" ) endif ( CMAKE_VERSION_24 ) # try to find the library: # CMAKE 2.4.x compatibility if ( CMAKE_VERSION_24 ) find_library( vrpn_LIBRARY NAMES vrpn PATHS ${vrpn_ROOT_DIR}/lib DOC "The directory in which you can find libvrpn.a") else ( CMAKE_VERSION_24 ) find_library( vrpn_LIBRARY NAMES vrpn HINTS ${vrpn_ROOT_DIR}/lib DOC "The directory in which you can find libvrpn.a") endif ( CMAKE_VERSION_24 ) # set the library directory: get_filename_component(vrpn_LIBRARY_DIR ${vrpn_LIBRARY} PATH ) MARK_AS_ADVANCED ( vrpn_INCLUDE_DIR vrpn_LIBRARY vrpn_LIBRARY_DIR ) # unmark when include-dir or library was not found within root dir if ( vrpn_ROOT_DIR AND NOT vrpn_INCLUDE_DIR ) MARK_AS_ADVANCED ( CLEAR vrpn_INCLUDE_DIR ) endif ( vrpn_ROOT_DIR AND NOT vrpn_INCLUDE_DIR ) if ( vrpn_ROOT_DIR AND NOT vrpn_LIBRARY ) MARK_AS_ADVANCED ( CLEAR vrpn_LIBRARY ) endif ( vrpn_ROOT_DIR AND NOT vrpn_LIBRARY ) ############################################################################### # set default stuff: ############################################################################### # handle the QUIETLY and REQUIRED arguments and set vrpn_FOUND to TRUE if # all listed variables are TRUE # CMAKE 2.4.x support if ( NOT CMAKE_VERSION_24 ) include( FindPackageHandleStandardArgs OPTIONAL RESULT_VARIABLE FindPackageHandleStandardsArgs_INCLUDED ) endif ( NOT CMAKE_VERSION_24 ) if ( FindPackageHandleStandardsArgs_INCLUDED ) FIND_PACKAGE_HANDLE_STANDARD_ARGS(vrpn DEFAULT_MSG vrpn_LIBRARY vrpn_INCLUDE_DIR) else ( FindPackageHandleStandardsArgs_INCLUDED ) set ( vrpn_FOUND TRUE ) if ( NOT vrpn_LIBRARY ) message( FATAL_ERROR "Unable to find vrpn_LIBRARY! Please set the correct vrpn_ROOT_DIR to the prefix of your vrpn installation!") set ( VRPN_FOUND FALSE ) endif ( NOT vrpn_LIBRARY ) if ( NOT vrpn_INCLUDE_DIR ) message( FATAL_ERROR "Unable to find vrpn_INCLUDE_DIR! Please set the correct vrpn_ROOT_DIR to the place of your vrpn installation!") set ( VRPN_FOUND FALSE ) endif ( NOT vrpn_INCLUDE_DIR ) endif ( FindPackageHandleStandardsArgs_INCLUDED ) if ( VRPN_FOUND ) set ( vrpn_FOUND true ) # FIND_PACKAGE_HANDLE_STANDARD_ARGS only sets VRPN_FOUND set ( vrpn_INCLUDE_DIRS ${vrpn_INCLUDE_DIR} ) set ( vrpn_LIBRARIES ${vrpn_LIBRARY} ) set ( vrpn_LIBRARY_DIRS ${vrpn_LIBRARY_DIR} ) endif (VRPN_FOUND ) ############################################################################### # Add compile-flags and definitions: ############################################################################### MARK_AS_ADVANCED( vrpn_FOUND vrpn_DEFINITIONS vrpn_INCLUDE_DIR vrpn_INCLUDE_DIRS vrpn_LIBRARY vrpn_LIBRARIES vrpn_LIBRARY_DIR vrpn_LIBRARY_DIRS vrpn_FRAMEWORKS )