1 # Copyright (C) 2009-2021 EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
21 PROJECT(SalomeGENERICSOLVER CXX)
25 # Project name, upper case
26 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
28 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 9)
29 SET(${PROJECT_NAME_UC}_MINOR_VERSION 7)
30 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
31 SET(${PROJECT_NAME_UC}_VERSION
32 ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
33 SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
37 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
38 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
39 LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
40 INCLUDE(SalomeMacros NO_POLICY_SCOPE)
42 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
48 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
49 IF(EXISTS ${KERNEL_ROOT_DIR})
50 FIND_PACKAGE(SalomeKERNEL REQUIRED)
51 ELSE(EXISTS ${KERNEL_ROOT_DIR})
52 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
53 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
57 INCLUDE(SalomeSetupPlatform) # From KERNEL
58 # Always build libraries as shared objects:
59 SET(BUILD_SHARED_LIBS TRUE)
64 FIND_PACKAGE(SalomePythonInterp REQUIRED)
65 FIND_PACKAGE(SalomePythonLibs REQUIRED)
66 FIND_PACKAGE(SalomeOmniORB REQUIRED)
67 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
70 # (default values taken from KERNEL)
72 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
73 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
74 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
75 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
76 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
77 "Install path: SALOME scripts")
78 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
79 "Install path: SALOME script data")
80 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
81 "Install path: SALOME Python scripts")
82 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
83 "Install path: SALOME application skeleton - scripts")
84 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
85 "Install path: SALOME application skeleton - Python")
86 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
87 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
88 "Install path: SALOME Python shared modules")
89 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
90 "Install path: local SALOME CMake files")
91 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
92 "Install path: local SALOME config files (obsolete, to be removed)")
93 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
94 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
96 # GENERICSOLVER specific:
97 SET(SALOME_GENERICSOLVER_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/genericsolver" CACHE PATH "Install path: SALOME GENERICSOLVER specific data")
99 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
100 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
101 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
102 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
103 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
104 MARK_AS_ADVANCED(SALOME_GENERICSOLVER_INSTALL_RES_DATA)
106 # Accumulate environment variables for GENERICSOLVER module
107 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS})
108 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
113 ADD_SUBDIRECTORY(resources)
114 ADD_SUBDIRECTORY(src)
115 ADD_SUBDIRECTORY(idl)
117 # Configuration export
118 # (here only the level 1 prerequisites are exposed)
119 # ====================
120 INCLUDE(CMakePackageConfigHelpers)
122 # List of targets in this project we want to make visible to the rest of the world.
123 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
124 SET(_${PROJECT_NAME}_exposed_targets
125 SalomeIDLGENERICSOLVER
128 # Add all targets to the build-tree export set
129 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
130 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
132 # Create the configuration files:
133 # - in the build tree:
135 # Ensure the variables are always defined for the configure:
136 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
138 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
139 # SALOME_CONFIGURE_PREPARE() #For use in the future
141 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
142 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
143 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
144 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX)
146 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
147 VERSION ${${PROJECT_NAME_UC}_VERSION}
148 COMPATIBILITY AnyNewerVersion)
150 # Install the CMake configuration files:
152 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
153 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
154 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
156 # Install the export set for use with the install-tree
157 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
158 FILE ${PROJECT_NAME}Targets.cmake)