]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Handle OpenCV optional product properly
authorvsr <vsr@opencascade.com>
Mon, 14 Oct 2013 16:22:57 +0000 (16:22 +0000)
committervsr <vsr@opencascade.com>
Mon, 14 Oct 2013 16:22:57 +0000 (16:22 +0000)
CMakeLists.txt
SalomeGEOMConfig.cmake.in

index 20952ade82898d781172c6881f84bab004fe266c..e59eee6010d7e7315877e40335d5f27aba61cf08 100755 (executable)
@@ -17,6 +17,8 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
+INCLUDE(CMakeDependentOption)
+
 PROJECT(SalomeGEOM C CXX)
 
 # Ensure a proper linker behavior:
@@ -64,8 +66,8 @@ OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ${SALOME_BUILD_TESTS})
 
 # Advanced options:
 OPTION(SALOME_BUILD_GUI       "Enable GUI" ON)
-OPTION(SALOME_GEOM_USE_OPENCV "Enable shape recognition from picture" OFF)
-
+CMAKE_DEPENDENT_OPTION(SALOME_GEOM_USE_OPENCV "Enable shape recognition from picture" OFF
+                       "SALOME_BUILD_GUI" OFF)
 MARK_AS_ADVANCED(SALOME_BUILD_GUI SALOME_GEOM_USE_OPENCV)
 
 # Prerequisites
@@ -141,19 +143,12 @@ ENDIF(SALOME_BUILD_GUI)
 FIND_PACKAGE(SalomeCAS REQUIRED)
 FIND_PACKAGE(SalomeVTK 6.0 REQUIRED)
 
-
-IF(SALOME_BUILD_GUI)
-  # OpenCV
-  IF(SALOME_GEOM_USE_OPENCV)
-    FIND_PACKAGE(SalomeOpenCV)
-    SALOME_LOG_OPTIONAL_PACKAGE(OpenCV SALOME_GEOM_USE_OPENCV)
-  ENDIF(SALOME_GEOM_USE_OPENCV)
-ELSE()
-  SET(SALOME_GEOM_USE_OPENCV OFF)
-ENDIF(SALOME_BUILD_GUI)
+# OpenCV
 IF(SALOME_GEOM_USE_OPENCV)
-  SET(OPENCV_DEFINITIONS "-DWITH_OPENCV")
-ENDIF()
+  FIND_PACKAGE(SalomeOpenCV REQUIRED)
+  SALOME_LOG_OPTIONAL_PACKAGE(OpenCV SALOME_GEOM_USE_OPENCV)
+  ADD_DEFINITIONS(-DWITH_OPENCV)
+ENDIF(SALOME_GEOM_USE_OPENCV)
 
 # Detection summary:
 SALOME_PACKAGE_REPORT_AND_CHECK()
index a0319f829c5aa91ebaa660c4da40efc7e2ba1a32..5cccc60289ce0e9cb97f5c85bfc0887bc5de5662 100644 (file)
@@ -64,6 +64,7 @@ IF(SALOME_BUILD_GUI)
 ENDIF()
 IF(SALOME_GEOM_USE_OPENCV)
   SET_AND_CHECK(OPENCV_ROOT_DIR_EXP "@PACKAGE_OPENCV_ROOT_DIR@")
+  ADD_DEFINITIONS(-DWITH_OPENCV)
 ENDIF()
 
 # For all prerequisites, load the corresponding targets if the package was used