summaryrefslogtreecommitdiffstats
path: root/cmake/FindFgLib5.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/FindFgLib5.cmake')
-rw-r--r--cmake/FindFgLib5.cmake47
1 files changed, 24 insertions, 23 deletions
diff --git a/cmake/FindFgLib5.cmake b/cmake/FindFgLib5.cmake
index 3f6a0c1..79964b7 100644
--- a/cmake/FindFgLib5.cmake
+++ b/cmake/FindFgLib5.cmake
@@ -1,22 +1,17 @@
FILE(TO_CMAKE_PATH "$ENV{SISODIR5}" SISODIR5)
-IF (FGLIB5_INCLUDE_DIR AND FGLIB5_LIBRARY)
- SET(FGLIB5_FIND_QUIETLY TRUE)
-ENDIF (FGLIB5_INCLUDE_DIR AND FGLIB5_LIBRARY)
-
-FIND_PATH(FGLIB5_INCLUDE_DIR fgrab_define.h
+FIND_PATH(FgLib5_INCLUDE_DIR fgrab_define.h
PATHS
"$ENV{FGLIB5}/include"
"${CMAKE_INSTALL_PREFIX}/include"
"${SISODIR5}/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Silicon Software GmbH\\Runtime5;Info]/include"
- "/opt/siso/include"
)
INCLUDE(SisoLibDir)
SISO_LIB_DIR("${SISODIR5}/lib" LIB_DIRS COMPILER_LIB_DIR)
-FIND_LIBRARY(FGLIB5_LIBRARY NAMES fglib5
+FIND_LIBRARY(FgLib5_LIBRARY NAMES fglib5
PATHS
"$ENV{FGLIB5}/lib"
"$ENV{FGLIB5}"
@@ -24,22 +19,28 @@ FIND_LIBRARY(FGLIB5_LIBRARY NAMES fglib5
${LIB_DIRS}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Silicon Software GmbH\\Runtime5;Info]/lib/${COMPILER_LIB_DIR}"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Silicon Software GmbH\\Runtime5;Info]/lib"
- "/opt/siso/lib"
)
-IF(FGLIB5_INCLUDE_DIR AND FGLIB5_LIBRARY)
- SET(FGLIB5_FOUND TRUE)
-ENDIF(FGLIB5_INCLUDE_DIR AND FGLIB5_LIBRARY)
+IF (FgLib5_INCLUDE_DIR AND EXISTS "${FgLib5_INCLUDE_DIR}/fgrab_define.h")
+ FILE(STRINGS "${FgLib5_INCLUDE_DIR}/fgrab_define.h" FGLIB_H_VERSION REGEX "^#define[ \\t]*FGLIB_VERSION_STRING[ \\t]*\"[^\"]*\"")
+ IF (FGLIB_H_VERSION)
+ STRING(REGEX REPLACE "^#define FGLIB_VERSION_STRING[ \\t]*\"([^\"]*)\".*" "\\1" FgLib5_VERSION_STRING "${FGLIB_H_VERSION}")
+ ENDIF (FGLIB_H_VERSION)
+ENDIF (FgLib5_INCLUDE_DIR AND EXISTS "${FgLib5_INCLUDE_DIR}/fgrab_define.h")
+
+INCLUDE(FindPackageHandleStandardArgs)
+IF (CMAKE_VERSION VERSION_LESS 2.8.4)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(FgLib5 DEFAULT_MSG FGLIB5_LIBRARY FGLIB5_INCLUDE_DIR)
+ELSE (CMAKE_VERSION VERSION_LESS 2.8.4)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(FgLib5
+ REQUIRED_VARS FgLib5_LIBRARY FgLib5_INCLUDE_DIR
+ VERSION_VAR FgLib5_VERSION_STRING)
+ENDIF (CMAKE_VERSION VERSION_LESS 2.8.4)
+
+SET(FgLib5_LIBRARIES ${FgLib5_LIBRARY})
-IF(FGLIB5_FOUND)
- IF(NOT FGLIB5_FIND_QUIETLY)
- MESSAGE(STATUS "Found Framegrabber library version 5: ${FGLIB5_LIBRARY}")
- ENDIF(NOT FGLIB5_FIND_QUIETLY)
- SET(FGLIB5_LIBRARIES ${FGLIB5_LIBRARY})
-ELSE(FGLIB5_FOUND)
- IF(FGLIB5_FIND_REQUIRED)
- IF(NOT FGLIB5_LIBRARY)
- MESSAGE(FATAL_ERROR "Framegrabber library version 5 not found")
- ENDIF(NOT FGLIB5_LIBRARY)
- ENDIF(FGLIB5_FIND_REQUIRED)
-ENDIF(FGLIB5_FOUND)
+# backward compatibility
+SET(FGLIB5_LIBRARY ${FgLib5_LIBRARY})
+SET(FGLIB5_LIBRARIES ${FgLib5_LIBRARIES})
+SET(FGLIB5_INCLUDE_DIR ${FgLib5_INCLUDE_DIR})
+SET(FGLIB5_FOUND ${FgLib5_FOUND})