Salome HOME
Update EDF build_options for master future 9.5.0
[tools/configuration.git] / cmake / FindSalomeCAS.cmake
1 # Copyright (C) 2013-2020  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: Adrien Bruneton
20 #
21
22 # OpenCascade detection for Salome
23 #
24 #  !! Please read the generic detection procedure in SalomeMacros.cmake !!
25 #
26
27 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(CAS CAS_INCLUDE_DIRS 1)
28
29 SET(OCCT_MINIMUM_VERSION "7.2")
30 IF(CAS_VERSION_STR VERSION_LESS ${OCCT_MINIMUM_VERSION})
31   MESSAGE(FATAL_ERROR "SALOME requires Open CASCADE Technology ${OCCT_MINIMUM_VERSION} or newer.")
32 ENDIF()
33
34 MARK_AS_ADVANCED(CAS_INCLUDE_DIRS)
35 MARK_AS_ADVANCED(
36   CAS_BinLPlugin
37   CAS_BinTObjPlugin
38   CAS_BinXCAFPlugin
39   CAS_PTKernel
40   CAS_StdLPlugin
41   CAS_StdPlugin
42   CAS_TKAdvTools
43   CAS_TKBin
44   CAS_TKBinL
45   CAS_TKBinTObj
46   CAS_TKBinXCAF
47   CAS_TKBO
48   CAS_TKBool
49   CAS_TKBRep
50   CAS_TKCAF
51   CAS_TKCDF
52   CAS_TKernel
53   CAS_TKFeat
54   CAS_TKFillet
55   CAS_TKG2d
56   CAS_TKG3d
57   CAS_TKGeomAlgo
58   CAS_TKGeomBase
59   CAS_TKHLR
60   CAS_TKIGES
61   CAS_TKLCAF
62   CAS_TKMath
63   CAS_TKMesh
64   CAS_TKMeshVS
65   CAS_TKNIS
66   CAS_TKOffset
67   CAS_TKOpenGl
68   CAS_TKPCAF
69   CAS_TKPLCAF
70   CAS_TKPrim
71   CAS_TKPShape
72   CAS_TKService
73   CAS_TKShapeSchema
74   CAS_TKShHealing
75   CAS_TKStd
76   CAS_TKStdL
77   CAS_TKStdLSchema
78   CAS_TKStdSchema
79   CAS_TKSTEP
80   CAS_TKSTEP209
81   CAS_TKSTEPAttr
82   CAS_TKSTEPBase
83   CAS_TKSTL
84   CAS_TKTObj
85   CAS_TKTopAlgo
86   CAS_TKV2d
87   CAS_TKV3d
88   CAS_TKVRML
89   CAS_TKXCAF
90   CAS_TKXCAFSchema
91   CAS_TKXDEIGES
92   CAS_TKXDESTEP
93   CAS_TKXMesh
94   CAS_TKXml
95   CAS_TKXmlL
96   CAS_TKXmlTObj
97   CAS_TKXmlXCAF
98   CAS_TKXSBase
99   CAS_XCAFPlugin
100   CAS_XmlLPlugin
101   CAS_XmlPlugin
102   CAS_XmlTObjPlugin
103   CAS_XmlXCAFPlugin
104   CAS_Xmu
105 )
106
107 SET(CAS_STDPLUGIN TKStd)
108 SET(CAS_BINPLUGIN TKBin)
109
110 # Workaround: detect and add freetype to CAS_INCLUDE_DIRS
111 # It will be suppressed after migration OCCT detection procedure to CONFIG mode
112 # and the correction of the several bugs in the OCCT CMake configuration.
113 SET(Freetype_DIR $ENV{FREETYPE_ROOT_DIR})
114 FIND_PACKAGE(Freetype)
115
116 # Standard CMake Findfreetype.cmake doesn't find ft2build.h, do it manually:
117 # 1. Find custom freetype
118 FIND_PATH( FREETYPE_INCLUDE_DIR_ft2build ft2build.h
119            PATHS $ENV{FREETYPE_ROOT_DIR}
120            PATH_SUFFIXES include/freetype2 include freetype2
121            NO_DEFAULT_PATH )
122
123 # 2. Find native freetype, if custom doesn't found:
124 IF(NOT FREETYPE_INCLUDE_DIR_ft2build)
125   FIND_PATH( FREETYPE_INCLUDE_DIR_ft2build ft2build.h
126              PATH_SUFFIXES include/freetype2 include freetype2 )
127 ENDIF()
128 SET(CAS_INCLUDE_DIRS ${CAS_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIR_freetype2} ${FREETYPE_INCLUDE_DIR_ft2build})
129 # End of workaround
130
131 IF(CAS_FOUND)
132   SALOME_ACCUMULATE_HEADERS(CAS_INCLUDE_DIRS)
133   SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${CAS_TKernel})
134 ENDIF()