Salome HOME
c18716eaec64f67c3bf3f55b2ca3341e17d1b90f
[modules/shaper_study.git] / SalomeSHAPERSTUDYConfig.cmake.in
1 ###############################################################
2 # Copyright (C) 2019-2020  CEA/DEN, EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 # - Config file for the @PROJECT_NAME@ package
22 # It defines the following variables. 
23 # Specific to the pacakge @PROJECT_NAME@ itself:
24 #  @PROJECT_NAME_UC@_ROOT_DIR_EXP - the root path of the installation providing this CMake file
25 #
26
27 ### Initialisation performed by CONFIGURE_PACKAGE_CONFIG_FILE:
28 @PACKAGE_INIT@
29
30 # Load the dependencies for the libraries of @PROJECT_NAME@ 
31 # (contains definitions for IMPORTED targets). This is only 
32 # imported if we are not built as a subproject (in this case targets are already there)
33 IF(NOT TARGET SalomeIDLSHAPERSTUDY AND NOT @PROJECT_NAME@_BINARY_DIR)
34   INCLUDE("@PACKAGE_SALOME_INSTALL_CMAKE_LOCAL@/@PROJECT_NAME@Targets.cmake")
35 ENDIF()   
36
37 # Package root dir:
38 SET_AND_CHECK(SHAPERSTUDY_ROOT_DIR_EXP "@PACKAGE_CMAKE_INSTALL_PREFIX@")
39
40 # Include directories
41 SET_AND_CHECK(SHAPERSTUDY_INCLUDE_DIRS "${SHAPERSTUDY_ROOT_DIR_EXP}/@SALOME_INSTALL_HEADERS@")
42 SET(SHAPERSTUDY_INCLUDE_DIRS "${SHAPERSTUDY_INCLUDE_DIRS};@_SalomeSHAPERSTUDY_EXTRA_HEADERS@")
43 SET(SHAPERSTUDY_DEFINITIONS "@GEOM_DEFINITIONS@")
44
45 # Package specific environment variables
46 @_SalomeSHAPERSTUDY_EXTRA_ENV_FULL@
47
48 #### Now the specificities
49
50 # Options exported by the package:
51 SET(SALOME_SHAPERSTUDY_BUILD_TESTS @SALOME_BUILD_TESTS@)
52 # TODO: documentation
53 # SET(SALOME_SHAPERSTUDY_BUILD_DOC   @SALOME_BUILD_DOC@)
54
55 # Level 1 prerequisites:
56 SET_AND_CHECK(GEOM_ROOT_DIR_EXP "@PACKAGE_GEOM_ROOT_DIR@")
57 SET_AND_CHECK(SHAPER_ROOT_DIR_EXP "@PACKAGE_SHAPER_ROOT_DIR@")
58
59 # For all prerequisites, load the corresponding targets if the package was used
60 # in CONFIG mode. This ensures dependent projects link correctly
61 # without having to set LD_LIBRARY_PATH:
62 SET(_PREREQ_@PROJECT_NAME@ @_PREREQ_LIST@)
63 SET(_PREREQ_@PROJECT_NAME@_CONFIG_DIR @_PREREQ_DIR_LIST@)
64 SET(_PREREQ_@PROJECT_NAME@_COMPONENTS "@_PREREQ_COMPO_LIST@")
65 LIST(LENGTH _PREREQ_@PROJECT_NAME@_CONFIG_DIR _list_len_@PROJECT_NAME@)
66 IF(NOT _list_len_@PROJECT_NAME@ EQUAL 0)
67   # Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
68   MATH(EXPR _range_@PROJECT_NAME@ "${_list_len_@PROJECT_NAME@}-1")
69   FOREACH(_p_@PROJECT_NAME@ RANGE ${_range_@PROJECT_NAME@})
70     LIST(GET _PREREQ_@PROJECT_NAME@            ${_p_@PROJECT_NAME@} _pkg_@PROJECT_NAME@    )
71     LIST(GET _PREREQ_@PROJECT_NAME@_CONFIG_DIR ${_p_@PROJECT_NAME@} _pkg_dir_@PROJECT_NAME@)
72     LIST(GET _PREREQ_@PROJECT_NAME@_COMPONENTS ${_p_@PROJECT_NAME@} _pkg_compo_@PROJECT_NAME@)
73     IF(NOT OMIT_DETECT_PACKAGE_${_pkg_@PROJECT_NAME@})
74       MESSAGE(STATUS "===> Reloading targets from ${_pkg_@PROJECT_NAME@} ...")
75       IF(NOT _pkg_compo_@PROJECT_NAME@)
76         FIND_PACKAGE(${_pkg_@PROJECT_NAME@} REQUIRED NO_MODULE
77             PATHS "${_pkg_dir_@PROJECT_NAME@}"
78             NO_DEFAULT_PATH)
79       ELSE()
80         STRING(REPLACE "," ";" _compo_lst_@PROJECT_NAME@ "${_pkg_compo_@PROJECT_NAME@}")
81         MESSAGE(STATUS "===> (components: ${_pkg_compo_@PROJECT_NAME@})")
82         FIND_PACKAGE(${_pkg_@PROJECT_NAME@} REQUIRED NO_MODULE
83             COMPONENTS ${_compo_lst_@PROJECT_NAME@}
84             PATHS "${_pkg_dir_@PROJECT_NAME@}"
85             NO_DEFAULT_PATH)
86       ENDIF()
87     ENDIF()
88   ENDFOREACH()
89 ENDIF()
90
91 # Include GEOM targets if they were not already loaded:
92 IF(NOT (TARGET GEOMbasic))
93   INCLUDE("${GEOM_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE_LOCAL}/SalomeGEOMTargets.cmake")
94 ENDIF(NOT (TARGET GEOMbasic))
95 # TODO: Include SHAPER targets, as soon as config file's support is implemented in SHAPER
96
97 # Exposed SHAPERSTUDY targets:
98 SET(SHAPERSTUDY_SalomeIDLSHAPERSTUDY SalomeIDLSHAPERSTUDY)
99 SET(SHAPERSTUDY_StudyData StudyData)