From: vsr Date: Mon, 14 Oct 2013 16:22:57 +0000 (+0000) Subject: Handle OpenCV optional product properly X-Git-Tag: BR_hydro_v_0_3_1~90 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=197ecbaecda52164fc161dbf370c73ed8c8d362e;p=modules%2Fgeom.git Handle OpenCV optional product properly --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 20952ade8..e59eee601 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/SalomeGEOMConfig.cmake.in b/SalomeGEOMConfig.cmake.in index a0319f829..5cccc6028 100644 --- a/SalomeGEOMConfig.cmake.in +++ b/SalomeGEOMConfig.cmake.in @@ -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