From eebd0d4d793a8ca37ea0ba45d422c0783827b789 Mon Sep 17 00:00:00 2001 From: abn Date: Tue, 5 Jul 2016 09:51:12 +0200 Subject: [PATCH] Moving CMake detection files to common CONFIGURATION repo. --- CMakeLists.txt | 21 ++- CMakeModules/FindLibbatchPThread.cmake | 28 ---- CMakeModules/FindLibbatchPython.cmake | 143 ------------------ CMakeModules/FindLibbatchSWIG.cmake | 27 ---- CMakeModules/FindPThread.cmake | 67 --------- CMakeModules/libbatchMacros.cmake | 195 ------------------------- 6 files changed, 15 insertions(+), 466 deletions(-) delete mode 100644 CMakeModules/FindLibbatchPThread.cmake delete mode 100644 CMakeModules/FindLibbatchPython.cmake delete mode 100644 CMakeModules/FindLibbatchSWIG.cmake delete mode 100644 CMakeModules/FindPThread.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 011a5db..81177a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,9 +34,18 @@ SET(${PROJECT_NAME_UC}_PATCH_VERSION 0) SET(${PROJECT_NAME_UC}_VERSION ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION}) -# Our own set of macros: -LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) -INCLUDE(libbatchMacros) +# Common CMake macros +# =================== +SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files") +IF(EXISTS ${CONFIGURATION_ROOT_DIR}) + LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake") + INCLUDE(SalomeMacros) +ELSE() + MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !") +ENDIF() + +# Our macros +INCLUDE(${PROJECT_SOURCE_DIR}/CMakeModules/libbatchMacros.cmake) # User options # ============ @@ -63,11 +72,11 @@ ENDIF() # Prerequisites detection: # ======================== -FIND_PACKAGE(LibbatchPThread REQUIRED) +FIND_PACKAGE(SalomePThread REQUIRED) IF (LIBBATCH_PYTHON_WRAPPING) - FIND_PACKAGE(LibbatchPython REQUIRED) - FIND_PACKAGE(LibbatchSWIG REQUIRED) + FIND_PACKAGE(SalomePythonLibs REQUIRED) + FIND_PACKAGE(SalomeSWIG REQUIRED) SET(PYTHON_VERSION "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") SET(LIBBATCH_PYTHONPATH lib/python${PYTHON_VERSION}/site-packages) diff --git a/CMakeModules/FindLibbatchPThread.cmake b/CMakeModules/FindLibbatchPThread.cmake deleted file mode 100644 index ae9dd94..0000000 --- a/CMakeModules/FindLibbatchPThread.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# Author: Adrien Bruneton -# - -# PThread detection for libBatch -# -# !! Please read the generic detection procedure in libbatchMacros.cmake !! -# -SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(PThread PTHREAD_INCLUDE_DIR 1) -MARK_AS_ADVANCED(PTHREAD_LIBRARIES PTHREAD_LIBRARY PTHREAD_INCLUDE_DIR) - diff --git a/CMakeModules/FindLibbatchPython.cmake b/CMakeModules/FindLibbatchPython.cmake deleted file mode 100644 index 6c3ecda..0000000 --- a/CMakeModules/FindLibbatchPython.cmake +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# Author: Adrien Bruneton -# - -# Python libraries and interpreter detection for libBatch -# The interpreter is found first, and if OK, the corresponding libraries are searched. -# We ensure the version of the libraries matches the one of the interpreter. -# - -# 1. Load environment or any previously detected Python -IF(DEFINED ENV{PYTHON_ROOT_DIR}) - FILE(TO_CMAKE_PATH "$ENV{PYTHON_ROOT_DIR}" _PYTHON_ROOT_DIR_ENV) - SET(_dflt_value "${_PYTHON_ROOT_DIR_ENV}") -ELSE() - # will be blank if no Python was previously loaded - SET(_dflt_value "${PYTHON_ROOT_DIR_EXP}") -ENDIF() - -# Make cache entry -SET(PYTHON_ROOT_DIR "${_dflt_value}" CACHE PATH "Path to Python directory (interpreter and libs)") - -# 2. Find package - config mode first (i.e. looking for XYZ-config.cmake) -IF(WIN32) - IF(CMAKE_BUILD_TYPE STREQUAL Debug) - SET(PythonInterp_FIND_VERSION _d) - SET(PYTHON_DEFINITIONS "-DHAVE_DEBUG_PYTHON") - ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug) -ENDIF(WIN32) -IF(EXISTS "${PYTHON_ROOT_DIR}") - # Hope to find direclty a CMake config file there - SET(_CONF_DIR "${PYTHON_ROOT_DIR}/share/cmake") - - # Try find_package in config mode with a hard-coded guess. This - # has the priority. - FIND_PACKAGE(Python CONFIG QUIET PATHS "${_CONF_DIR}") - MARK_AS_ADVANCED(Python_DIR) - - IF (NOT PYTHON_FOUND) - LIST(APPEND CMAKE_PREFIX_PATH "${PYTHON_ROOT_DIR}") - ELSE() - MESSAGE(STATUS "Found Python in CONFIG mode!") - ENDIF() -ENDIF() - -# Otherwise try the standard way (module mode, with the standard CMake Find*** macro): -SALOME_FIND_PACKAGE(LibbatchPython PythonInterp MODULE) -SET(_found1 ${PYTHONINTERP_FOUND}) - -IF (PYTHONINTERP_FOUND) - # Now ensure we find the Python libraries matching the interpreter: - # This uses the variable PYTHON_EXECUTABLE - GET_FILENAME_COMPONENT(_python_dir "${PYTHON_EXECUTABLE}" PATH) - GET_FILENAME_COMPONENT(CMAKE_INCLUDE_PATH "${_python_dir}/../include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" ABSOLUTE) - GET_FILENAME_COMPONENT(CMAKE_LIBRARY_PATH "${_python_dir}/../lib" ABSOLUTE) - # For a Windows install, this might look more like this: - IF(WIN32) - LIST(APPEND CMAKE_LIBRARY_PATH "${_python_dir}/libs" ABSOLUTE) - LIST(APPEND CMAKE_INCLUDE_PATH "${_python_dir}/include" ABSOLUTE) - ENDIF() - # Override the EXACT and VERSION settings of the LibbatchPython module - # to force the next call to SALOME_FIND_PACKAGE() to find the exact matching - # version: - SET(_old_EXACT ${LibbatchPython_FIND_VERSION_EXACT}) - SET(_old_VERSION "${LibbatchPython_FIND_VERSION}") - SET(LibbatchPython_FIND_VERSION_EXACT TRUE) - SET(LibbatchPython_FIND_VERSION "${PYTHON_VERSION_STRING}") - # Prepare call to FIND_PACKAGE(PythonLibs) and ensure priority is given to - # the location found for the interpreter: - GET_FILENAME_COMPONENT(_tmp "${_python_dir}" PATH) - SALOME_FIND_PACKAGE(LibbatchPython PythonLibs MODULE) - # Restore variables: - SET(LibbatchPython_FIND_VERSION_EXACT ${_old_EXACT}) - SET(LibbatchPython_FIND_VERSION "${_old_VERSION}") -ENDIF() - -# Set the FOUND flag for LibbatchPython: -SET(LIBBATCHPYTHON_FOUND FALSE) -IF (_found1 AND PYTHONLIBS_FOUND) - SET(LIBBATCHPYTHON_FOUND TRUE) -ENDIF() - -IF (LIBBATCHPYTHON_FOUND) - MESSAGE(STATUS "Python interpreter and Python libraries found:") - MESSAGE(STATUS "Python libraries: ${PYTHON_LIBRARY}") - MESSAGE(STATUS "Python include dir: ${PYTHON_INCLUDE_DIR}") - - # 3. Set the root dir which was finally retained - # For Python this is the grand-parent of the - # include directory: - GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${PYTHON_INCLUDE_DIR}" PATH) - IF(NOT WIN32) - GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH) - ENDIF() - - # 4. Warn if CMake found something not located under ENV(XYZ_ROOT_DIR) - IF(DEFINED ENV{PYTHON_ROOT_DIR}) - SALOME_CHECK_EQUAL_PATHS(_res "${_tmp_ROOT_DIR}" "${_PYTHON_ROOT_DIR_ENV}") - IF(NOT _res) - MESSAGE(WARNING "Python was found, but not a the path given by the " -"environment PYTHON_ROOT_DIR! Is the variable correctly set?") - ELSE() - MESSAGE(STATUS "Python found directory matches what was specified in the PYTHON_ROOT_DIR, all good!") - ENDIF() - ENDIF() - - # 5. Conflict detection - # 5.1 From another prerequisite using Python - IF(PYTHON_ROOT_DIR_EXP) - SALOME_CHECK_EQUAL_PATHS(_res "${_tmp_ROOT_DIR}" "${PYTHON_ROOT_DIR_EXP}") - IF(NOT _res) - MESSAGE(WARNING "Warning: Python: detected version conflicts with a previously found Python!" - "The two paths are " ${_tmp_ROOT_DIR} " vs " ${PYTHON_ROOT_DIR_EXP}) - ELSE() - MESSAGE(STATUS "Python directory matches what was previously exposed by another prereq, all good!") - ENDIF() - ENDIF() - - # 6. Finally retained variable: - SET(PYTHON_ROOT_DIR "${_tmp_ROOT_DIR}") - - # 7. Specifics - ## None here -ELSE(LIBBATCHPYTHON_FOUND) - MESSAGE(STATUS "Python was only partially (or not at all) found .") -ENDIF(LIBBATCHPYTHON_FOUND) - diff --git a/CMakeModules/FindLibbatchSWIG.cmake b/CMakeModules/FindLibbatchSWIG.cmake deleted file mode 100644 index 99529fc..0000000 --- a/CMakeModules/FindLibbatchSWIG.cmake +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# Author: Adrien Bruneton -# - -# SWIG detection for libbatch -# -# !! Please read the generic detection procedure in libbatchMacros.cmake !! -# -SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 2) -MARK_AS_ADVANCED(SWIG_EXECUTABLE SWIG_VERSION) diff --git a/CMakeModules/FindPThread.cmake b/CMakeModules/FindPThread.cmake deleted file mode 100644 index db09833..0000000 --- a/CMakeModules/FindPThread.cmake +++ /dev/null @@ -1,67 +0,0 @@ -# - Find PThread -# This module finds an installed PThread using the variable PTHREAD_ROOT_DIR -# as a lookup path. -# It sets the following variables: -# PTHREAD_FOUND - set to true if PThread is found -# PTHREAD_INCLUDE_DIR - the directory where the include files are located -# PTHREAD_LIBRARY - the path to PThread library -# -# The file "pthread.h" is looked for PTHREAD_INCLUDE_DIR. -# Libraries are searched with following names: -# pthread -# On Win32: -# pthreadVSE2 pthreadVC2 -# or in Debug mode: -# pthreadVSE2d pthreadVC2d -# - - -############################################################# -# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -IF (NOT PThread_FIND_QUIETLY) - MESSAGE(STATUS "Looking for PThread...") -ENDIF () - -IF(WIN32) - SET(PTHREADS_INCLUDE_TO_FIND pthread.h) - FIND_PATH(PTHREAD_INCLUDE_DIR ${PTHREADS_INCLUDE_TO_FIND}) - # Default build type is assumed to be Release: - IF(NOT CMAKE_BUILD_TYPE STREQUAL Debug) - FIND_LIBRARY(PTHREAD_LIBRARY pthreadVC2) - ELSE() - FIND_LIBRARY(PTHREAD_LIBRARY pthreadVC2d) - ENDIF() -ELSE(WIN32) - FIND_PATH(PTHREAD_INCLUDE_DIR pthread.h) - FIND_LIBRARY(PTHREAD_LIBRARY NAMES pthread) -ENDIF(WIN32) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PThread REQUIRED_VARS PTHREAD_INCLUDE_DIR PTHREAD_LIBRARY) - -IF (PTHREAD_FOUND) - IF (NOT PThread_FIND_QUIETLY) - MESSAGE(STATUS "PThread library: ${PTHREAD_LIBRARY}") - ENDIF (NOT PThread_FIND_QUIETLY) -ENDIF() diff --git a/CMakeModules/libbatchMacros.cmake b/CMakeModules/libbatchMacros.cmake index 4d9846b..ae2c9f7 100644 --- a/CMakeModules/libbatchMacros.cmake +++ b/CMakeModules/libbatchMacros.cmake @@ -107,198 +107,3 @@ MACRO(LIBBATCH_SUMMARY) MESSAGE(STATUS "") ENDMACRO() -### -# SALOME_CHECK_EQUAL_PATHS(result path1 path2) -# Check if two paths are identical, resolving links. If the paths do not exist a simple -# text comparison is performed. -# result is a boolean. -### -MACRO(SALOME_CHECK_EQUAL_PATHS varRes path1 path2) - SET("${varRes}" OFF) - IF(EXISTS "${path1}") - GET_FILENAME_COMPONENT(_tmp1 "${path1}" REALPATH) - ELSE() - SET(_tmp1 "${path1}") - ENDIF() - - IF(EXISTS "${path2}") - GET_FILENAME_COMPONENT(_tmp2 "${path2}" REALPATH) - ELSE() - SET(_tmp2 "${path2}") - ENDIF() - - IF("${_tmp1}" STREQUAL "${_tmp2}") - SET("${varRes}" ON) - ENDIF() -# MESSAGE(${${varRes}}) -ENDMACRO() - - -#### -# SALOME_FIND_PACKAGE(englobingPackageName standardPackageName modus) -# Encapsulate the call to the standard FIND_PACKAGE(standardPackageName) passing all the options -# given when calling the command FIND_PACKAGE(customPackageName) -# Modus is either MODULE or CONFIG (cf standard FIND_PACKAGE() documentation). -# This macro is to be called from within the FindCustomPackage.cmake file. -#### -MACRO(SALOME_FIND_PACKAGE englobPkg stdPkg mode) - # Only bother if the package was not already found: - # Some old packages use the lower case version - standard should be to always use - # upper case: - STRING(TOUPPER ${stdPkg} stdPkgUC) - IF(NOT (${stdPkg}_FOUND OR ${stdPkgUC}_FOUND)) - IF(${englobPkg}_FIND_QUIETLY) - SET(_tmp_quiet "QUIET") - ELSE() - SET(_tmp_quiet) - ENDIF() - IF(${englobPkg}_FIND_REQUIRED) - SET(_tmp_req "REQUIRED") - ELSE() - SET(_tmp_req) - ENDIF() - IF(${englobPkg}_FIND_VERSION_EXACT) - SET(_tmp_exact "EXACT") - ELSE() - SET(_tmp_exact) - ENDIF() - IF(${englobPkg}_FIND_COMPONENTS) - STRING(REPLACE ";" " " _tmp_compo ${${englobPkg}_FIND_COMPONENTS}) - ELSE() - SET(_tmp_compo) - ENDIF() - - # Call the root FIND_PACKAGE(): - #MESSAGE("blabla ${englobPkg} / ${${englobPkg}_FIND_VERSION_EXACT} / ${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} ${mode}") - IF(_tmp_compo) - FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} ${mode} ${_tmp_quiet} ${_tmp_req} COMPONENTS ${_tmp_compo}) - ELSE() - FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} ${mode} ${_tmp_quiet} ${_tmp_req}) - ENDIF() - ENDIF() -ENDMACRO() - -####################################################################" -# SALOME_FIND_PACKAGE_DETECT_CONFLICTS(pkg referenceVariable upCount) -# pkg : name of the system package to be detected -# referenceVariable: variable containing a path that can be browsed up to -# retrieve the package root directory (xxx_ROOT_DIR) -# upCount : number of times we have to go up from the path -# to obtain the package root directory. -# -# For example: SALOME_FIND_PACKAGE_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 2) -# -# Generic detection (and conflict check) procedure for package XYZ: -# 1. Load a potential env variable XYZ_ROOT_DIR as a default choice for the cache entry XYZ_ROOT_DIR -# If empty, load a potential XYZ_ROOT_DIR_EXP as default value (path exposed by another package depending -# directly on XYZ) -# 2. Invoke FIND_PACKAGE() in this order: -# * in CONFIG mode first (if possible): priority is given to a potential -# "XYZ-config.cmake" file -# * then switch to the standard MODULE mode, appending on CMAKE_PREFIX_PATH -# the above XYZ_ROOT_DIR variable -# 3. Extract the path actually found into a temp variable _XYZ_TMP_DIR -# 4. Warn if XYZ_ROOT_DIR is set and doesn't match what was found (e.g. when CMake found the system installation -# instead of what is pointed to by XYZ_ROOT_DIR - happens when a typo in the content of XYZ_ROOT_DIR). -# 5. Conflict detection: -# * check the temp variable against a potentially existing XYZ_ROOT_DIR_EXP -# 6. Finally expose what was *actually* found in XYZ_ROOT_DIR. -# 7. Specific stuff: for example exposing a prerequisite of XYZ to the rest of the world for future -# conflict detection. This is added after the call to the macro by the callee. -# -MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount) - STRING(TOUPPER ${pkg} pkg_UC) - - # 1. Load environment or any previously detected root dir for the package - IF(DEFINED ENV{${pkg_UC}_ROOT_DIR}) - FILE(TO_CMAKE_PATH "$ENV{${pkg_UC}_ROOT_DIR}" _${pkg_UC}_ROOT_DIR_ENV) - SET(_dflt_value "${_${pkg_UC}_ROOT_DIR_ENV}") - ELSE() - # will be blank if no package was previously loaded - SET(_dflt_value "${${pkg_UC}_ROOT_DIR_EXP}") - ENDIF() - - # Make cache entry - SET(${pkg_UC}_ROOT_DIR "${_dflt_value}" CACHE PATH "Path to ${pkg_UC} directory") - - # 2. Find package - config mode first (i.e. looking for XYZ-config.cmake) - IF(EXISTS "${${pkg_UC}_ROOT_DIR}") - # Hope to find direclty a CMake config file there - SET(_CONF_DIR "${${pkg_UC}_ROOT_DIR}/share/cmake") - - # Try find_package in config mode with a hard-coded guess. This - # has the priority. - FIND_PACKAGE(${pkg} NO_MODULE QUIET PATHS "${_CONF_DIR}") - MARK_AS_ADVANCED(${pkg}_DIR) - - IF (NOT ${pkg_UC}_FOUND) - SET(CMAKE_PREFIX_PATH "${${pkg_UC}_ROOT_DIR}") - ELSE() - MESSAGE(STATUS "Found ${pkg} in CONFIG mode!") - ENDIF() - ENDIF() - - # Otherwise try the standard way (module mode, with the standard CMake Find*** macro): - SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} MODULE) - #MESSAGE("dbg ${pkg_UC} / ${PTHREAD_FOUND} / ${${pkg_UC}_FOUND}") - # Set the "FOUND" variable for the SALOME wrapper: - IF(${pkg_UC}_FOUND OR ${pkg}_FOUND) - SET(SALOME${pkg_UC}_FOUND TRUE) - ELSE() - SET(SALOME${pkg_UC}_FOUND FALSE) - ENDIF() - - IF (${pkg_UC}_FOUND OR ${pkg}_FOUND) - # 3. Set the root dir which was finally retained by going up "upDir" times - # from the given reference path. The variable "referenceVariable" may be a list - # - we take its first element. - # Note the double de-reference of "referenceVariable": - LIST(LENGTH "${${referenceVariable}}" _tmp_len) - IF(_tmp_len) - LIST(GET "${${referenceVariable}}" 0 _tmp_ROOT_DIR) - ELSE() - SET(_tmp_ROOT_DIR "${${referenceVariable}}") - ENDIF() - IF(${upCount}) - MATH(EXPR _rge "${upCount}-1") - FOREACH(_unused RANGE ${_rge}) - GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH) - ENDFOREACH() - ENDIF() - - # 4. Warn if CMake found something not located under ENV(XYZ_ROOT_DIR) - IF(DEFINED ENV{${pkg_UC}_ROOT_DIR}) - SALOME_CHECK_EQUAL_PATHS(_res "${_tmp_ROOT_DIR}" "${_${pkg_UC}_ROOT_DIR_ENV}") - IF(NOT _res) - MESSAGE(WARNING "${pkg} was found, but not at the path given by the " - "environment ${pkg_UC}_ROOT_DIR! Is the variable correctly set? " - "The two paths are: ${_tmp_ROOT_DIR} and: ${_${pkg_UC}_ROOT_DIR_ENV}") - - ELSE() - MESSAGE(STATUS "${pkg} found directory matches what was specified in the ${pkg_UC}_ROOT_DIR variable, all good!") - ENDIF() - ELSE() - MESSAGE(STATUS "Variable ${pkg_UC}_ROOT_DIR was not explicitly defined: " - "an installation was found anyway: ${_tmp_ROOT_DIR}") - ENDIF() - - # 5. Conflict detection - # 5.1 From another prerequisite using the package - IF(${pkg_UC}_ROOT_DIR_EXP) - SALOME_CHECK_EQUAL_PATHS(_res "${_tmp_ROOT_DIR}" "${${pkg_UC}_ROOT_DIR_EXP}") - IF(NOT _res) - MESSAGE(WARNING "Warning: ${pkg}: detected version conflicts with a previously found ${pkg}!" - "The two paths are " ${_tmp_ROOT_DIR} " vs " ${${pkg_UC}_ROOT_DIR_EXP}) - ELSE() - MESSAGE(STATUS "${pkg} directory matches what was previously exposed by another prereq, all good!") - ENDIF() - ENDIF() - - # 6. Save the found installation - # - SET(${pkg_UC}_ROOT_DIR "${_tmp_ROOT_DIR}") - - ELSE() - MESSAGE(STATUS "${pkg} was not found.") - ENDIF() -ENDMACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS) -- 2.39.2