Salome HOME
Copyright update 2021
[tools/configuration.git] / cmake / FindSalomeOpenCASCADE.cmake
1 # Copyright (C) 2013-2021  CEA/DEN, EDF R&D, OPEN CASCADE
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 # Author: Roman NIKOLAEV
20 #
21
22 # OpenCascade detection for Salome
23 #
24 #  !! Please read the generic detection procedure in SalomeMacros.cmake !!
25 #
26
27 # TODO: RNV: Check different OCCT layouts !!!
28 IF(WIN32)
29   SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(OpenCASCADE OpenCASCADE_INCLUDE_DIR 1)
30 ELSE()
31   SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(OpenCASCADE OpenCASCADE_INCLUDE_DIR 2)
32 ENDIF()
33
34 IF(OpenCASCADE_FOUND)
35   
36   IF(NOT CAS_FIND_QUIETLY)
37       MESSAGE(STATUS "Found OpenCascade version: ${OpenCASCADE_VERSION}")
38   ENDIF()
39
40   # OPENCASCADE definitions
41   SET(OpenCascade_DEFINITIONS ${OpenCASCADE_C_FLAGS} ${OpenCASCADE_CXX_FLAGS})
42   SET(OpenCascade_LDFLAGS ${OpenCASCADE_LINKER_FLAGS})
43
44   SALOME_ACCUMULATE_HEADERS(OpenCASCADE_INCLUDE_DIR)
45   SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${OpenCASCADE_LIBRARY_DIR})
46   IF(WIN32)
47     # RNV: Fix bug with OCCT CMake build procedure:
48     #      In Debug ${OpenCASCADE_BINARY_DIR} and ${OpenCASCADE_LIBRARY_DIR} are stored in the
49     #      config file w/o "d" suffix. To be checked with latest version of OCCT.
50     SET(SUFF "")
51     IF(${OpenCASCADE_BUILD_WITH_DEBUG})
52       SET(SUFF "d")
53     ENDIF()
54     SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${OpenCASCADE_BINARY_DIR}${SUFF})
55   ENDIF()
56
57 ELSE()
58   # TODO: Detect OpenCASCADE if it is distributed without CMake configuration.
59   IF(NOT CAS_FIND_QUIETLY)
60     MESSAGE(STATUS "Could not find OpenCASCADE ...")
61   ENDIF()
62 ENDIF()