Merge pull request #16122 from alalek:cmake_update_cpu_compiler_detection
[platform/upstream/opencv.git] / cmake / OpenCVFindXimea.cmake
1 # - Find XIMEA
2 # This module finds if XIMEA Software package is installed
3 # and determines where the binaries and header files are.
4 # This code sets the following variables:
5 #
6 #  XIMEA_FOUND          - True if XIMEA API found
7 #  XIMEA_PATH:          - Path to the XIMEA API folder
8 #  XIMEA_LIBRARY_DIR    - XIMEA libraries folder
9 #
10 # Created: 5 Aug 2011 by Marian Zajko (marian.zajko@ximea.com)
11 # Updated: 25 June 2012 by Igor Kuzmin (parafin@ximea.com)
12 # Updated: 22 October 2012 by Marian Zajko (marian.zajko@ximea.com)
13 #
14
15 set(XIMEA_FOUND)
16 set(XIMEA_PATH)
17 set(XIMEA_LIBRARY_DIR)
18
19 if(WIN32)
20   # Try to find the XIMEA API path in registry.
21   GET_FILENAME_COMPONENT(XIMEA_PATH "[HKEY_CURRENT_USER\\Software\\XIMEA\\CamSupport\\API;Path]" ABSOLUTE)
22
23   if(EXISTS ${XIMEA_PATH})
24     set(XIMEA_FOUND 1)
25     # set LIB folders
26     if(X86_64)
27       set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x64")
28     else()
29       set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x86")
30     endif()
31   else()
32     set(XIMEA_FOUND 0)
33   endif()
34 elseif(APPLE)
35   if(EXISTS /Library/Frameworks/m3api.framework)
36     set(XIMEA_FOUND 1)
37   else()
38     set(XIMEA_FOUND 0)
39   endif()
40 else()
41   if(EXISTS /opt/XIMEA)
42     set(XIMEA_FOUND 1)
43     # set folders
44     set(XIMEA_PATH /opt/XIMEA/include)
45   else()
46     set(XIMEA_FOUND 0)
47   endif()
48 endif()
49
50 mark_as_advanced(FORCE XIMEA_FOUND)
51 mark_as_advanced(FORCE XIMEA_PATH)
52 mark_as_advanced(FORCE XIMEA_LIBRARY_DIR)