diff cmake/FindOCC.cmake @ 624:01e01777ff50

CMake: initial import of CMake modules, closes #720
author David Demelier <markand@malikania.fr>
date Fri, 20 Oct 2017 14:18:37 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/FindOCC.cmake	Fri Oct 20 14:18:37 2017 +0200
@@ -0,0 +1,59 @@
+# FindOCC
+# -------
+#
+# Find vanilla OpenCascade libraries. It has *not* been tested with OpenCascade
+# community edition.
+#
+# This modules defines:
+# OCC_INCLUDE_DIRS, where to find OSD.hxx
+# OCC_LIBRARIES, where to find components libraries
+# OCC_FOUND, if it is found
+#
+# This module understand components. Just pass the library name to
+# the components variable and the following variables will
+# be defined:
+#
+# e.g find_package(OCC COMPONENTS TKbool)
+#
+# OCC_Xxx_LIBRARY where to find the library
+# OCC_Xxx_FOUND if the variable is found
+#
+# The OCC_LIBRARIES is automatically filled with all components.
+
+include(FindPackageMessage)
+
+# find OSD.hxx
+find_path(
+    OCC_INCLUDE_DIR OSD.hxx
+    PATH_SUFFIXES
+        OpenCASCADE
+        inc
+)
+
+foreach (c ${OCC_FIND_COMPONENTS})
+    find_library(
+        OCC_${c}_LIBRARY ${c}
+        PATH_SUFFIXES
+            win32/vc11/lib
+    )
+
+    if (OCC_${c}_LIBRARY)
+        set(OCC_${c}_FOUND TRUE)
+        list(APPEND OCC_LIBRARIES ${OCC_${c}_LIBRARY})
+        mark_as_advanced(OCC_${c}_LIBRARY)
+    endif ()
+endforeach ()
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(
+    OCC
+    HANDLE_COMPONENTS
+    REQUIRED_VARS OCC_INCLUDE_DIR
+)
+
+if (OCC_FOUND)
+    set(OCC_INCLUDE_DIRS ${OCC_INCLUDE_DIR})
+endif ()
+
+mark_as_advanced(OCC_INCLUDE_DIR OCC_LIBRARIES)