Salome HOME
Updated copyright comment
[tools/configuration.git] / cmake / FindSalomeKERNEL.cmake
1 # Copyright (C) 2007-2024  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 # Author: Adrien Bruneton
20 #
21
22 # KERNEL detection for salome - this is typically called by dependent modules
23 # (GUI, PARAVIS, etc ...)
24 #
25 # The detection is simpler than for other prerequisites.
26 # Indeed calling SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS() with SalomeKERNEL is tricky:
27 #  - one would write  SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(KERNEL xyz n)
28 #  - then the macro would look first for a file named SalomeKERNELConfig.cmake (=the normal situation)
29 #  - if not found (because KERNEL_ROOT_DIR was badly set for example) the macro would then look
30 # for a file named FindSalomeKERNEL.cmake
31 #  => this is the current file, and that would trigger an infinite recursion ... :-)
32 #  This could be detected with a flag mechanism, but honestly this becomes an overkill.
33 #
34 # So we go for a simple lookup, without conflict check:
35 #
36
37 IF(NOT SalomeKERNEL_FIND_QUIETLY)
38   MESSAGE(STATUS "Looking for Salome KERNEL ...")
39 ENDIF()
40
41 SET(CMAKE_PREFIX_PATH "${KERNEL_ROOT_DIR}")
42 SALOME_FIND_PACKAGE(SalomeKERNEL SalomeKERNEL CONFIG)
43
44 IF(NOT SalomeKERNEL_FIND_QUIETLY)
45   MESSAGE(STATUS "Found Salome KERNEL: ${KERNEL_ROOT_DIR}")
46 ENDIF()
47
48 FOREACH(_res ${SalomeKERNEL_EXTRA_ENV})
49   SALOME_ACCUMULATE_ENVIRONMENT(${_res} "${SalomeKERNEL_EXTRA_ENV_${_res}}")
50 ENDFOREACH()
51
52 #----------------------------------------------------------------------------
53 # KERNEL_WITH_CORBA is a macro useful for determining whether a KERNEL module 
54 # builded in not light mode(with CORBA)
55 #----------------------------------------------------------------------------
56 MACRO(KERNEL_WITH_CORBA)
57   IF(SALOME_KERNEL_LIGHT_ONLY)
58     MESSAGE(FATAL_ERROR "\nWe absolutely need a Salome KERNEL module with CORBA.\nPlease set option SALOME_LIGHT_ONLY to OFF when building KERNEL module.")
59   ENDIF()
60 ENDMACRO(KERNEL_WITH_CORBA)