Salome HOME
4290259903f1b424e81bc18184172608bcb75d83
[modules/shaper.git] / CMakeCommon / FindPlaneGCS.cmake
1 # Copyright (C) 2014-2023  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # - Try to  find PlaneGCS (sketcher part of FreeCAD)
21 # Once done this will define
22 #
23 #  PLANEGCS_FOUND - system has PlaneGCS
24 #  PLANEGCS_INCLUDE_DIRS - the Plaine include directory
25 #  PLANEGCS_LIBRARIES - Link these to use PlaneGCS
26
27 IF(NOT PLANEGCS_FIND_QUIETLY)
28   MESSAGE(STATUS "Try to find PlainGCS at $ENV{PLANEGCS_ROOT_DIR}...")
29 ENDIF()
30
31 FIND_PATH(PLANEGCS_INCLUDE_DIR NAMES GCS.h
32   HINTS ENV PLANEGCS_ROOT_DIR
33   PATH_SUFFIXES include
34 )
35
36 FIND_PATH(PLANEGCS_CMAKE_DIR NAMES FindEigen3.cmake
37   HINTS ENV PLANEGCS_ROOT_DIR
38   PATH_SUFFIXES cmake
39 )
40
41 FIND_LIBRARY(PLANEGCS_LIBRARY NAMES PlaneGCS
42   HINTS ENV PLANEGCS_ROOT_DIR
43   PATH_SUFFIXES lib
44 )
45
46 # verify Eigen and Boost libraries are found
47 FILE(TO_CMAKE_PATH "$ENV{EIGEN_ROOT_DIR}/include/eigen3" EIGEN3_INCLUDE_DIR)
48 FILE(TO_CMAKE_PATH "$ENV{BOOST_ROOT_DIR}" BOOST_ROOT)
49 SET(CMAKE_MODULE_PATH "${PLANEGCS_CMAKE_DIR}" ${CMAKE_MODULE_PATH})
50 FIND_PACKAGE(Eigen3 3.2.5 REQUIRED)
51 FIND_PACKAGE(Boost COMPONENTS graph REQUIRED)
52
53 IF(Boost_FOUND AND EIGEN3_FOUND)
54   SET(PLANEGCS_INCLUDE_DIRS ${PLANEGCS_INCLUDE_DIR})
55   SET(PLANEGCS_LIBRARIES ${PLANEGCS_LIBRARY})
56 ENDIF()
57
58 # handle the QUIETLY and REQUIRED arguments and set PLANEGCS_FOUND to TRUE
59 # if all listed variables are TRUE
60 INCLUDE(FindPackageHandleStandardArgs)
61 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PlaneGCS
62                                   REQUIRED_VARS PLANEGCS_LIBRARY PLANEGCS_INCLUDE_DIR)
63
64 MARK_AS_ADVANCED(PLANEGCS_LIBRARY PLANEGCS_INCLUDE_DIR)