# Find OptiTrack # # This module defines # OptiTrack_FOUND # OptiTrack_INCLUDE_DIRS # OptiTrack_LIBRARIES # # Copyright (c) 2012 I-maginer # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA, or go to # http://www.gnu.org/copyleft/lesser.txt # # On a new cmake run, we do not need to be verbose IF(OptiTrack_INCLUDE_DIR AND OptiTrack_LIBRARY) SET(OptiTrack_FIND_QUIETLY TRUE) ENDIF() # If OptiTrack_ROOT was defined in the environment, use it. if (NOT OptiTrack_ROOT AND NOT $ENV{NP_CAMERASDK} STREQUAL "") set(OptiTrack_ROOT $ENV{NP_CAMERASDK}) endif() # concat all the search paths IF(OptiTrack_ROOT) SET(OptiTrack_INCLUDE_SEARCH_DIRS ${OptiTrack_INCLUDE_SEARCH_DIRS} ${OptiTrack_ROOT}/include ) SET(OptiTrack_LIBRARY_SEARCH_DIRS ${OptiTrack_LIBRARY_SEARCH_DIRS} ${OptiTrack_ROOT}/lib ) ENDIF() # log message IF (NOT OptiTrack_FIND_QUIETLY) MESSAGE(STATUS "Checking for Natural Point OptiTrack SDK") ENDIF() # Search for header files FIND_PATH(OptiTrack_INCLUDE_DIR cameralibrary.h PATHS ${OptiTrack_INCLUDE_SEARCH_DIRS}) # Search for libraries files if(WIN32 AND (WIN64 OR (CMAKE_SIZEOF_VOID_P EQUAL 8))) FIND_LIBRARY(OptiTrack_LIBRARY cameralibraryx64 PATHS ${OptiTrack_LIBRARY_SEARCH_DIRS}) else () FIND_LIBRARY(OptiTrack_LIBRARY cameralibrary PATHS ${OptiTrack_LIBRARY_SEARCH_DIRS}) endif () # Configure libraries SET(OptiTrack_INCLUDE_DIRS ${OptiTrack_INCLUDE_DIR} CACHE STRING "Directory containing NaturalPoint OptiTrack SDK header files") SET(OptiTrack_LIBRARIES ${OptiTrack_LIBRARY} CACHE STRING "NaturalPoint OptiTrack SDK libraries files") # Hide those variables in GUI SET(OptiTrack_INCLUDE_DIR ${OptiTrack_INCLUDE_DIR} CACHE INTERNAL "") SET(OptiTrack_LIBRARY ${OptiTrack_LIBRARY} CACHE INTERNAL "") IF(OptiTrack_INCLUDE_DIRS AND OptiTrack_LIBRARY) SET(OptiTrack_FOUND TRUE) ENDIF() # log find result IF(OptiTrack_FOUND) IF(NOT OptiTrack_FIND_QUIETLY) MESSAGE(STATUS " libraries: ${OptiTrack_LIBRARIES}") MESSAGE(STATUS " includes: ${OptiTrack_INCLUDE_DIRS}") ENDIF() ELSE(OptiTrack_FOUND) IF(NOT OptiTrack_LIBRARIES) MESSAGE(STATUS, "NaturalPoint OptiTrack SDK library files could not be found") ENDIF() IF(NOT OptiTrack_INCLUDE_DIRS) MESSAGE(STATUS "NaturalPoint OptiTrack SDK include files could not be found") ENDIF() ENDIF(OptiTrack_FOUND)