Salome HOME
updated copyright message
[tools/configuration.git] / cmake / FindSalomeNetgen.cmake
1 # Copyright (C) 2013-2023  CEA, EDF, 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
20 SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Netgen NETGEN_INCLUDE_DIRS 1)
21 MARK_AS_ADVANCED(NETGEN_INCLUDE_DIRS NETGEN_LIBRARIES)
22
23 # process case when netgen is found in config mode
24 IF(NOT NETGEN_DEFINITIONS AND NETGEN_COMPILE_DEFINITIONS)
25   SET(NETGEN_DEFINITIONS)
26   FOREACH(_ng_def ${NETGEN_COMPILE_DEFINITIONS})
27     LIST(APPEND NETGEN_DEFINITIONS "-D${_ng_def}")
28   ENDFOREACH()
29 ENDIF()
30 IF(NOT NETGEN_LIBRARIES)
31   SET(NETGEN_LIBRARIES)
32   FOREACH(_ng_lib nglib csg gen geom2d gprim interface la mesh occ stl ngcore)
33     IF(TARGET ${_ng_lib})
34       LIST(APPEND NETGEN_LIBRARIES "${_ng_lib}")
35     ENDIF()
36   ENDFOREACH()
37 ENDIF()
38 IF(NOT NETGEN_V5 AND NOT NETGEN_V6 AND NETGEN_VERSION_MAJOR)
39   IF(NETGEN_VERSION_MAJOR VERSION_EQUAL 6)
40     SET(NETGEN_V6 ON)
41   ELSEIF(NETGEN_VERSION_MAJOR VERSION_EQUAL 5)
42     SET(NETGEN_V5 ON)
43   ENDIF()
44 ENDIF()
45 IF(NETGEN_INCLUDE_DIR AND NETGEN_INCLUDE_DIRS)
46   LIST(APPEND NETGEN_INCLUDE_DIRS ${NETGEN_INCLUDE_DIR}/core)
47 ENDIF()
48 IF(NETGEN_INCLUDE_DIRS)
49   LIST(REMOVE_DUPLICATES NETGEN_INCLUDE_DIRS)
50 ENDIF()
51
52 IF(NETGEN_V6)
53   MESSAGE(STATUS "NETGEN V6 or newer found")
54   SET(NETGEN_DEFINITIONS "${NETGEN_DEFINITIONS} -DNETGEN_V6")
55 ELSEIF(NETGEN_V5)
56   MESSAGE(STATUS "NETGEN V5 found")
57   SET(NETGEN_DEFINITIONS "${NETGEN_DEFINITIONS} -DNETGEN_V5")
58 ENDIF()
59
60 IF(NETGEN_FOUND)
61   SALOME_ACCUMULATE_HEADERS(NETGEN_INCLUDE_DIRS)
62   SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${NETGEN_LIBRARIES})
63 ENDIF()