Salome HOME
Update copyrights
[tools/configuration.git] / cmake / FindSalomeKERNEL.cmake
1 # Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 # Author: Adrien Bruneton
23 #
24
25 # KERNEL detection for salome - this is typically called by dependent modules
26 # (GUI, PARAVIS, etc ...)
27 #
28 # The detection is simpler than for other prerequisites.
29 # Indeed calling SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS() with SalomeKERNEL is tricky:
30 #  - one would write  SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(KERNEL xyz n)
31 #  - then the macro would look first for a file named SalomeKERNELConfig.cmake (=the normal situation)
32 #  - if not found (because KERNEL_ROOT_DIR was badly set for example) the macro would then look
33 # for a file named FindSalomeKERNEL.cmake
34 #  => this is the current file, and that would trigger an infinite recursion ... :-)
35 #  This could be detected with a flag mechanism, but honestly this becomes an overkill.
36 #
37 # So we go for a simple lookup, without conflict check:
38 #
39
40 IF(NOT SalomeKERNEL_FIND_QUIETLY)
41   MESSAGE(STATUS "Looking for Salome KERNEL ...")
42 ENDIF()
43
44 SET(CMAKE_PREFIX_PATH "${KERNEL_ROOT_DIR}")
45 SALOME_FIND_PACKAGE(SalomeKERNEL SalomeKERNEL CONFIG)
46
47 IF(NOT SalomeKERNEL_FIND_QUIETLY)
48   MESSAGE(STATUS "Found Salome KERNEL: ${KERNEL_ROOT_DIR}")
49 ENDIF()
50
51 FOREACH(_res ${SalomeKERNEL_EXTRA_ENV})
52   SALOME_ACCUMULATE_ENVIRONMENT(${_res} "${SalomeKERNEL_EXTRA_ENV_${_res}}")
53 ENDFOREACH()
54
55 #----------------------------------------------------------------------------
56 # KERNEL_WITH_CORBA is a macro useful for determining whether a KERNEL module 
57 # builded in not light mode(with CORBA)
58 #----------------------------------------------------------------------------
59 MACRO(KERNEL_WITH_CORBA)
60   IF(SALOME_KERNEL_LIGHT_ONLY)
61     MESSAGE(FATAL_ERROR "\nWe absolutely need a Salome KERNEL module with CORBA.\nPlease set option SALOME_LIGHT_ONLY to OFF when building KERNEL module.")
62   ENDIF()
63 ENDMACRO(KERNEL_WITH_CORBA)