1 # Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE
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
19 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
20 PROJECT(SalomeHELLO C CXX)
22 # Ensure a proper linker behavior:
23 CMAKE_POLICY(SET CMP0003 NEW)
25 CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib
30 # Project name, upper case
31 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
33 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 9)
34 SET(${PROJECT_NAME_UC}_MINOR_VERSION 2)
35 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
36 SET(${PROJECT_NAME_UC}_VERSION
37 ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
38 SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
42 SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
43 IF(EXISTS ${CONFIGURATION_ROOT_DIR})
44 LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
47 MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
52 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
53 IF(EXISTS ${KERNEL_ROOT_DIR})
54 LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
56 FIND_PACKAGE(SalomeKERNEL REQUIRED)
57 KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA
58 ELSE(EXISTS ${KERNEL_ROOT_DIR})
59 MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR")
60 ENDIF(EXISTS ${KERNEL_ROOT_DIR})
64 INCLUDE(SalomeSetupPlatform) # From KERNEL
65 # Always build libraries as shared objects:
66 SET(BUILD_SHARED_LIBS TRUE)
68 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local/cmake_files")
72 OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON)
73 OPTION(SALOME_BUILD_DOC "Generate SALOME HELLO documentation" ON)
75 IF(SALOME_BUILD_TESTS)
79 FIND_PACKAGE(SalomeDoxygen)
80 SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC)
86 FIND_PACKAGE(SalomePythonInterp REQUIRED)
87 FIND_PACKAGE(SalomePythonLibs REQUIRED)
88 FIND_PACKAGE(SalomeOmniORB REQUIRED)
89 FIND_PACKAGE(SalomeOmniORBPy REQUIRED)
94 SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI")
95 IF(EXISTS ${GUI_ROOT_DIR})
96 LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files")
97 FIND_PACKAGE(SalomeGUI REQUIRED)
98 SALOME_GUI_WITH_CORBA() # check whether GUI builded with CORBA
99 SALOME_GUI_MODE(OPTIONAL SALOME_USE_PYCONSOLE)
100 ADD_DEFINITIONS(${GUI_DEFINITIONS})
101 INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS})
102 ELSE(EXISTS ${GUI_ROOT_DIR})
103 MESSAGE(FATAL_ERROR "We absolutely need a Salome GUI, please define GUI_ROOT_DIR")
104 ENDIF(EXISTS ${GUI_ROOT_DIR})
109 FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
111 IF(NOT SALOME_GUI_BUILD_WITH_QT5)
112 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui)
114 FIND_PACKAGE(SalomeQt5 REQUIRED)
118 SALOME_PACKAGE_REPORT_AND_CHECK()
121 # (default values taken from KERNEL)
123 SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOME binaries")
124 SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs")
125 SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files")
126 SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers")
127 SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH
128 "Install path: SALOME scripts")
129 SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH
130 "Install path: SALOME script data")
131 SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH
132 "Install path: SALOME Python scripts")
133 SET(SALOME_INSTALL_APPLISKEL_SCRIPTS "${SALOME_INSTALL_APPLISKEL_SCRIPTS}" CACHE PATH
134 "Install path: SALOME application skeleton - scripts")
135 SET(SALOME_INSTALL_APPLISKEL_PYTHON "${SALOME_INSTALL_APPLISKEL_PYTHON}" CACHE PATH
136 "Install path: SALOME application skeleton - Python")
137 SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff")
138 SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH
139 "Install path: SALOME Python shared modules")
140 SET(SALOME_INSTALL_CMAKE_LOCAL "${SALOME_INSTALL_CMAKE_LOCAL}" CACHE PATH
141 "Install path: local SALOME CMake files")
142 SET(SALOME_INSTALL_AMCONFIG_LOCAL "${SALOME_INSTALL_AMCONFIG_LOCAL}" CACHE PATH
143 "Install path: local SALOME config files (obsolete, to be removed)")
144 SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME resources")
145 SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation")
148 SET(SALOME_HELLO_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/hello" CACHE PATH
149 "Install path: SALOME HELLO specific data")
151 MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SALOME_INSTALL_HEADERS)
152 MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON)
153 MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES)
154 MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED)
155 MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC)
156 MARK_AS_ADVANCED(SALOME_HELLO_INSTALL_RES_DATA)
158 # Accumulate environment variables for HELLO module
159 SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
160 ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON})
161 SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
166 ADD_SUBDIRECTORY(idl)
167 ADD_SUBDIRECTORY(adm_local)
168 ADD_SUBDIRECTORY(resources)
169 ADD_SUBDIRECTORY(src)
170 ADD_SUBDIRECTORY(bin)
172 ADD_SUBDIRECTORY(doc)
175 # Header configuration
176 # ====================
177 SALOME_XVERSION(${PROJECT_NAME})
178 SALOME_CONFIGURE_FILE(HELLO_version.h.in HELLO_version.h INSTALL ${SALOME_INSTALL_HEADERS})
180 # Configuration export
181 # (here only the level 1 prerequisites are exposed)
182 # ====================
183 INCLUDE(CMakePackageConfigHelpers)
185 # List of targets in this project we want to make visible to the rest of the world.
186 # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
187 SET(_${PROJECT_NAME}_exposed_targets
188 HELLOEngine HELLO SalomeIDLHELLO
191 # Add all targets to the build-tree export set
192 EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
193 FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
195 # Create the configuration files:
196 # - in the build tree:
198 # Ensure the variables are always defined for the configure:
199 SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
201 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
203 # Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
204 # SALOME_CONFIGURE_PREPARE() #For use in the future
206 CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
207 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
208 INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
209 PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
212 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
213 VERSION ${${PROJECT_NAME_UC}_VERSION}
214 COMPATIBILITY AnyNewerVersion)
216 # Install the CMake configuration files:
218 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
219 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
220 DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}")
222 # Install the export set for use with the install-tree
223 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
224 FILE ${PROJECT_NAME}Targets.cmake)