Handle OpenCV optional product properly

This commit is contained in:
vsr 2013-10-14 16:22:57 +00:00
parent 17497fdd95
commit 197ecbaecd
2 changed files with 10 additions and 14 deletions

View File

@ -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()

View 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