# These files are data, module or lib files
SET(DATA
- FindCppUnit.cmake
- FindGraphviz.cmake
+ FindCPPUNIT.cmake
FindKERNEL.cmake
- FindOmniORB.cmake
- FindPThread.cmake
- FindSalomeBoost.cmake
- FindSalomeCppUnit.cmake
- FindSalomeDoxygen.cmake
- FindSalomeGraphviz.cmake
+ FindOMNIORB.cmake
+ UseOMNIORB.cmake
+ FindPLATFORM.cmake
+ FindSPHINX.cmake
+ FindSalomeBOOST.cmake
+ FindSalomeCPPUNIT.cmake
+ FindSalomeDOXYGEN.cmake
FindSalomeHDF5.cmake
- FindSalomeLibBatch.cmake
- FindSalomeLibXml2.cmake
+ FindSalomeLIBBATCH.cmake
+ FindSalomeLIBXML2.cmake
FindSalomeMPI.cmake
- FindSalomeOmniORB.cmake
- FindSalomePThread.cmake
- FindSalomePython.cmake
- FindSalomeSphinx.cmake
+ FindSalomePYTHON.cmake
+ FindSalomeSPHINX.cmake
FindSalomeSWIG.cmake
- FindSphinx.cmake
InstallAndCompilePythonFile.cmake
- UseOmniORB.cmake
SalomeMacros.cmake
- SalomeSetupPlatform.cmake
)
-INSTALL(FILES ${DATA} DESTINATION ${SALOME_INSTALL_CMAKE})
+INSTALL(FILES ${DATA} DESTINATION ${KERNEL_salomeadmcmake})
# These files are executable scripts
-SALOME_INSTALL_SCRIPTS(prepare_generating_doc.py ${SALOME_INSTALL_SCRIPT_SCRIPTS})
+SALOME_INSTALL_SCRIPTS(prepare_generating_doc.py ${KERNEL_salomescript_SCRIPTS})
+++ /dev/null
-# - Find CppUnit
-# Sets the following variables:
-# CPPUNIT_INCLUDE_DIR - path to the CppUnit include directory
-# CPPUNIT_LIBRARIES - path to the CppUnit libraries to be linked against
-# CPPUNIT_DEFINITIONS - specific CppUnit definitions to be added
-#
-# The header cppunit/extensions/HelperMacros.h is looked for.
-# The following libraries are searched
-# cppunit_dll, or cppunitd_dll (Windows)
-# cppunit (Linux)
-#
-
-#########################################################################
-# Copyright (C) 2007-2013 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.
-#
-# 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 CppUnit_FIND_QUIETLY)
- MESSAGE(STATUS "Looking for CppUnit ...")
-ENDIF()
-
-# Headers
-SET(CPPUNIT_INCLUDE_TO_FIND cppunit/extensions/HelperMacros.h)
-FIND_PATH(CPPUNIT_INCLUDE_DIR ${CPPUNIT_INCLUDE_TO_FIND})
-
-# Libraries
-IF(WINDOWS)
- IF(CMAKE_BUILD_TYPE STREQUAL Debug)
- FIND_LIBRARY(CPPUNIT_LIBRARIES cppunitd_dll)
- ELSE(CMAKE_BUILD_TYPE STREQUAL Debug)
- FIND_LIBRARY(CPPUNIT_LIBRARIES cppunit_dll)
- ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
-ELSE(WINDOWS)
- FIND_LIBRARY(CPPUNIT_LIBRARIES cppunit)
-ENDIF(WINDOWS)
-
-# Global variables
-SET(CPPUNIT_DEFINITIONS)
-IF(WINDOWS)
- SET(CPPUNIT_DEFINITIONS -DCPPUNIT_DLL)
-ENDIF(WINDOWS)
-
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(CppUnit REQUIRED_VARS CPPUNIT_INCLUDE_DIR CPPUNIT_LIBRARIES)
-
-
+++ /dev/null
-# - Find OmniORB4 cmake module and Pyhon backends
-#
-# Sets the following variables:
-# OMNIORB_FOUND - TRUE if OmniORB4 installation has been found
-# OMNIORB_INCLUDE_DIR - OmniORB4 headers path
-# OMNIORB_LIBRARIES - OmniORB4 libraries
-# OMNIORB_VERSION - OmniORB4 version
-# OMNIORB_IDL_COMPILER - OmniORB4 idl compiler command (omniidl)
-# OMNIORB_NAMESERVER - OmniORB4 CORBA naming service (omniNames)
-# OMNIORB_PYTHON_BACKEND
-# and many other mainly used in UseOmniORB.cmake
-#
-# Detection is made through calls to
-# find_library, find_program, find_path
-# and can be guided by extending CMAKE_PREFIX_PATH. Given the CMake precedence
-# rule this will take precedence over the standard system paths.
-# See for example doc of find_library().
-#
-
-################################################################
-# Copyright (C) 2007-2013 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.
-#
-# 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
-#
-################################################################
-
-# minimum OmniORB4 supported version
-# 4.0.6 has known bug float/double marshalling using CORBA::Any
-set(OMNIORB_MINIMUM_VERSION "4.1.2")
-
-IF(WIN32)
- # Guide the FIND_LIBRARY command towards the correct directory <...>/lib/x86_win32:
- SET(CMAKE_LIBRARY_ARCHITECTURE x86_win32)
-ENDIF()
-
-##############################################################################
-# find headers
-##############################################################################
-FIND_PATH(OMNIORB_INCLUDE_DIR omniORB4/CORBA.h)
-
-##############################################################################
-# find libraries
-##############################################################################
-IF (WIN32)
- FIND_LIBRARY(OMNIORB_LIBRARY_omniORB4
- NAMES ${CMAKE_STATIC_LIBRARY_PREFIX}omniORB4${CMAKE_STATIC_LIBRARY_SUFFIX})
- FIND_LIBRARY( OMNIORB_LIBRARY_omnithread
- NAMES ${CMAKE_STATIC_LIBRARY_PREFIX}omnithread${CMAKE_STATIC_LIBRARY_SUFFIX})
- FIND_LIBRARY( OMNIORB_LIBRARY_omniDynamic4
- NAMES ${CMAKE_STATIC_LIBRARY_PREFIX}omniDynamic4${CMAKE_STATIC_LIBRARY_SUFFIX})
-ELSE (WIN32)
- FIND_LIBRARY(OMNIORB_LIBRARY_omniORB4 NAMES omniORB4)
- FIND_LIBRARY(OMNIORB_LIBRARY_omnithread NAMES omnithread)
- FIND_LIBRARY(OMNIORB_LIBRARY_omniDynamic4 NAMES omniDynamic4)
-ENDIF (WIN32)
-
-# Optional libraries
-
-IF (WIN32)
- FIND_LIBRARY( OMNIORB_LIBRARY_COS4
- NAMES ${CMAKE_STATIC_LIBRARY_PREFIX}COS4${CMAKE_STATIC_LIBRARY_SUFFIX})
- FIND_LIBRARY( OMNIORB_LIBRARY_COSDynamic4
- NAMES ${CMAKE_STATIC_LIBRARY_PREFIX}COSDynamic4${CMAKE_STATIC_LIBRARY_SUFFIX})
-ELSE (WIN32)
- FIND_LIBRARY(OMNIORB_LIBRARY_COS4 NAMES COS4)
- FIND_LIBRARY(OMNIORB_LIBRARY_COSDynamic4 NAMES COSDynamic4)
-ENDIF (WIN32)
-
-##############################################################################
-# find command line tools
-##############################################################################
-IF (WIN32)
- FIND_PROGRAM( OMNIORB_IDL_COMPILER
- NAMES omniidl PATHS bin/x86_win32
- DOC "What is the path where omniidl (the idl compiler) can be found")
- FIND_PROGRAM( OMNIORB_OMNINAMES_COMMAND
- NAMES omniNames PATHS bin/x86_win32
- DOC "What is the path where omniNames (the ORB server) can be found")
-ELSE(WIN32)
- FIND_PROGRAM(OMNIORB_IDL_COMPILER NAMES omniidl)
- FIND_PROGRAM(OMNIORB_NAMESERVER NAMES omniNames)
-ENDIF (WIN32)
-
-##############################################################################
-# find python back-end
-##############################################################################
-
-SET(_py_version "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
-SET(CMAKE_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH})
-SET(_doc "Path to python-backend directory (omniidl_be) including python.py file")
-IF(WIN32)
- FIND_PATH(OMNIORB_PYTHON_BACKEND
- NAMES python.py PATHS "/lib/python/omniidl_be" DOC ${_doc})
-ELSE()
- FIND_PATH(OMNIORB_PYTHON_BACKEND
- NAMES python.py
- PATHS "/lib/python${_py_version}/site-packages/omniidl_be" "/usr/lib/omniidl/omniidl_be"
- DOC ${_doc})
-ENDIF()
-
-##############################################################################
-# Cook our stuff
-##############################################################################
-
-MARK_AS_ADVANCED(OMNIORB_DIR OMNIORB_INCLUDE_DIR)
-MARK_AS_ADVANCED(OMNIORB_LIBRARY_omniORB4 OMNIORB_LIBRARY_omnithread OMNIORB_LIBRARY_omniDynamic4)
-MARK_AS_ADVANCED(OMNIORB_IDL_COMPILER OMNIORB_NAMESERVER OMNIORB_VERSION)
-MARK_AS_ADVANCED(OMNIORB_LIBRARY_COS4 OMNIORB_LIBRARY_COSDynamic4 OMNIORB_PYTHON_BACKEND)
-
-SET(OMNIORB_LIBRARIES
- ${OMNIORB_LIBRARY_omniORB4}
- ${OMNIORB_LIBRARY_omnithread}
- ${OMNIORB_LIBRARY_omniDynamic4})
-
-IF(OMNIORB_LIBRARY_COS4)
- LIST(APPEND OMNIORB_LIBRARIES ${OMNIORB_LIBRARY_COS4})
-ENDIF()
-IF(OMNIORB_LIBRARY_COSDynamic4)
- LIST(APPEND OMNIORB_LIBRARIES ${OMNIORB_LIBRARY_COSDynamic4})
-ENDIF()
-
-# Optionaly, extract the the version number from the acconfig.h file:
-# The version check is done at the very bottom of this file.
-IF( EXISTS ${OMNIORB_INCLUDE_DIR}/omniORB4/acconfig.h )
- FILE( READ ${OMNIORB_INCLUDE_DIR}/omniORB4/acconfig.h OMNIORB_ACCONFIG_H )
- STRING( REGEX MATCH "#define[\t ]+PACKAGE_VERSION[\t ]+\"([0-9]+.[0-9]+.[0-9]+)\"" OMNIORB_ACCONFIG_H "${OMNIORB_ACCONFIG_H}" )
- STRING( REGEX REPLACE ".*\"([0-9]+.[0-9]+.[0-9]+)\".*" "\\1" OMNIORB_VERSION "${OMNIORB_ACCONFIG_H}" )
-ELSE()
- SET( OMNIORB_VERSION "NOT-FOUND" )
-ENDIF( EXISTS ${OMNIORB_INCLUDE_DIR}/omniORB4/acconfig.h )
-
-SET(OMNIORB_IDLCXXFLAGS -Wba -nf)
-SET(OMNIORB_IDLPYFLAGS -bpython)
-IF (OMNIORB_PYTHON_BACKEND)
- SET(OMNIORB_IDLPYFLAGS "-p ${OMNIORB_PYTHON_BACKEND} ${OMNIORB_IDLPYFLAGS}")
-ENDIF()
-SET(IDLCXXFLAGS ${OMNIORB_IDLCXXFLAGS})
-SET(IDLPYFLAGS ${OMNIORB_IDLPYFLAGS})
-SET(IDL_CLN_H .hh)
-SET(IDL_SRV_H .hh)
-SET(OMNIORB_DEFINITIONS "-D__x86__ -DCOMP_CORBA_DOUBLE -DCOMP_CORBA_LONG")
-IF(WIN32)
- SET(OMNIORB_DEFINITIONS "${OMNIORB_DEFINITIONS} -D__WIN32__")
-ENDIF()
-IF(APPLE)
- SET(OMNIORB_DEFINITIONS "${OMNIORB_DEFINITIONS} -D__macos__")#for omnithread.h to be checked...
-ENDIF()
-
-# Handle standard arguments:
-INCLUDE(FindPackageHandleStandardArgs)
-IF(OMNIORB_VERSION)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(OmniORB
- REQUIRED_VARS OMNIORB_INCLUDE_DIR OMNIORB_LIBRARY_omniORB4 OMNIORB_LIBRARY_omnithread
- OMNIORB_LIBRARY_omniDynamic4 OMNIORB_IDL_COMPILER OMNIORB_PYTHON_BACKEND
- VERSION_VAR OMNIORB_VERSION )
-ELSE()
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(OmniORB
- REQUIRED_VARS OMNIORB_INCLUDE_DIR OMNIORB_LIBRARY_omniORB4 OMNIORB_LIBRARY_omnithread
- OMNIORB_LIBRARY_omniDynamic4 OMNIORB_IDL_COMPILER OMNIORB_PYTHON_BACKEND)
-ENDIF()
--- /dev/null
+# Copyright (C) 2007-2013 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.
+#
+# 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(WINDOWS)
+ SET(MACHINE WINDOWS)
+ELSEIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(MACHINE PCLINUX64)
+ELSE(WINDOWS)
+ SET(MACHINE PCLINUX)
+ENDIF(WINDOWS)
+
+IF(NOT CMAKE_BUILD_TYPE)
+ SET(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE})
+ENDIF(NOT CMAKE_BUILD_TYPE)
+
+IF(NOT CMAKE_BUILD_TYPE)
+ SET(CMAKE_BUILD_TYPE Release)
+ENDIF(NOT CMAKE_BUILD_TYPE)
+
+IF(WINDOWS OR APPLE)
+ELSE(WINDOWS OR APPLE)
+ SET(ADD_WERROR ON)
+ SET(NAMES ACCEPT_SALOME_WARNINGS ACCEPT_${MODULE}_WARNINGS I_AM_A_TROLL_I_DO_NOT_FIX_${MODULE}_WARNINGS)
+ FOREACH(name ${NAMES})
+ SET(VAL $ENV{${name}})
+ IF(X${VAL} STREQUAL X0)
+ SET(ADD_WERROR ON)
+ ENDIF(X${VAL} STREQUAL X0)
+ IF(X${VAL} STREQUAL X1)
+ SET(ADD_WERROR OFF)
+ ENDIF(X${VAL} STREQUAL X1)
+ ENDFOREACH(name ${NAMES})
+ IF(ADD_WERROR)
+# SET(CMAKE_C_FLAGS "-Werror")
+# SET(CMAKE_CXX_FLAGS "-Werror")
+ ENDIF(ADD_WERROR)
+ENDIF(WINDOWS OR APPLE)
+
+IF(CMAKE_BUILD_TYPE)
+ IF(WINDOWS)
+ MARK_AS_ADVANCED(CLEAR CMAKE_CONFIGURATION_TYPES)
+ SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} CACHE STRING "compilation types" FORCE)
+ ELSE(WINDOWS)
+ IF(CMAKE_BUILD_TYPE STREQUAL Debug)
+ SET(CMAKE_C_FLAGS_DEBUG "-g")
+ SET(CMAKE_CXX_FLAGS_DEBUG "-g")
+ ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
+ IF(CMAKE_BUILD_TYPE STREQUAL Release)
+ SET(CMAKE_C_FLAGS_RELEASE "-O1 -DNDEBUG")
+ SET(CMAKE_CXX_FLAGS_RELEASE "-O1 -DNDEBUG")
+ ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
+ ENDIF(WINDOWS)
+ENDIF(CMAKE_BUILD_TYPE)
+
+SET(PLATFORM_LIBS)
+SET(PLATFORM_DEFINITIONS)
+
+IF(WINDOWS)
+ SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} /W0")
+ SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_CRT_SECURE_NO_WARNINGS") # To disable windows warnings for strcpy, fopen, ...
+ SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_SCL_SECURE_NO_WARNINGS") # To disable windows warnings std::copy, std::transform, ...
+ SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DWNT")
+ SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DPPRO_NT") # For medfile
+ SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_USE_MATH_DEFINES") # At least for MEDMEM
+ SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_WIN32_WINNT=0x0500") # Windows 2000 or later API is required
+ SET(PLATFORM_LIBS ${PLATFORM_LIBS} Ws2_32.lib)
+ SET(PLATFORM_LIBS ${PLATFORM_LIBS} Userenv.lib) # At least for GEOM suit
+
+ IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") # if platform is Windows 64 bit
+ SET(PLATFORM_CPPFLAGS "${PLATFORM_CPPFLAGS} -D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0 -D_HAS_ITERATOR_DEBUGGING=0") # To avoid runtime error during checking iterators # to be removed
+ SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0 -D_HAS_ITERATOR_DEBUGGING=0") # To avoid runtime error during checking iterators
+ ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+ELSE(WINDOWS)
+ SET(PLATFORM_LIBS ${PLATFORM_LIBS} -ldl)
+ENDIF(WINDOWS)
+
+SET(SIZE_OF_LONG ${CMAKE_SIZEOF_VOID_P}) # set sizeof(long) the same as size of pointers, because on all memory models (EXCLUDING WINDOWS 64 bit) it is equivalent values
+IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8" AND WINDOWS) # if it platform Windows 64 bit
+ SET(SIZE_OF_LONG "4") # set sizeof(long) to 4 byte
+ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8" AND WINDOWS)
+
+SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${SIZE_OF_LONG} -DSIZEOF_INT=4")
+ADD_DEFINITIONS(${PLATFORM_DEFINITIONS})
+SET(COMPILATION_WITH_CMAKE ON)
+++ /dev/null
-# Copyright (C) 2013 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.
-#
-# 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
-#
-
-# Boost detection dor Salome
-#
-# !! Please read the generic detection procedure in SalomeMacros.cmake !!
-#
-SET(Boost_USE_STATIC_LIBS OFF)
-SET(Boost_USE_MULTITHREADED ON )
-SET(Boost_USE_STATIC_RUNTIME OFF)
-
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Boost Boost_INCLUDE_DIRS 1)
-#MARK_AS_ADVANCED()
+++ /dev/null
-# Copyright (C) 2013 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.
-#
-# 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
-#
-
-# CppUnit detection for Salome
-#
-# !! Please read the generic detection procedure in SalomeMacros.cmake !!
-#
-
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(CppUnit CPPUNIT_INCLUDE_DIR 1)
-MARK_AS_ADVANCED(CPPUNIT_INCLUDE_DIR CPPUNIT_LIBRARIES)
+++ /dev/null
-# Copyright (C) 2013 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.
-#
-# 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
-#
-
-# Doxygen detection for salome
-#
-# !! Please read the generic detection procedure in SalomeMacros.cmake !!
-#
-
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Doxygen DOXYGEN_EXECUTABLE 2)
-#MARK_AS_ADVANCED()
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# Author: Adrien Bruneton
-#
# HDF5 detection for Salome
-#
-# !! Please read the generic detection procedure in SalomeMacros.cmake !!
-#
-# --- HDF5 specificities ----
-# MPI root directory used for HDF5 compilation is exposed into MPI_ROOT_DIR_EXP
-#
-
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(HDF5 HDF5_INCLUDE_DIR 1)
-MARK_AS_ADVANCED(FORCE HDF5_INCLUDE_DIR HDF5_LIB)
-
-# 7. Expose MPI configuration to the rest of the world
-IF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL)
- # Set only one reference boolean variable:
- # (unfortunately what is found in /usr/share/cmake/Modules/FindHDF5.cmake
- # and in the native HDF5-config.cmake differ!)
- SET(HDF5_IS_PARALLEL TRUE)
-
- # HDF5 was compiled with MPI support
- # Unfortunately HDF5 doesn't expose its MPI configuration easily ...
- # We sniff the properties of the HDF5 target which should also be there:
- GET_PROPERTY(_lib_lst TARGET hdf5 PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG)
- FOREACH(s ${_lib_lst})
- STRING(FIND "${s}" "mpi." _res) # should cover WIN(?) and LINUX
- IF(_res GREATER -1)
- GET_FILENAME_COMPONENT(_tmp "${s}" PATH) # go up to levels
- GET_FILENAME_COMPONENT(MPI_ROOT_DIR_EXP "${_tmp}" PATH)
- BREAK()
- ENDIF()
- ENDFOREACH()
- IF(NOT SalomeHDF5_FIND_QUIETLY)
- MESSAGE(STATUS "HDF5 was compiled with MPI: ${MPI_ROOT_DIR_EXP}")
- ENDIF()
-ENDIF()
+set(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR} CACHE PATH "Path to Hdf5 directory")
+if(EXISTS ${HDF5_ROOT_DIR})
+ set(CMAKE_INCLUDE_PATH ${HDF5_ROOT_DIR}/include)
+ set(CMAKE_LIBRARY_PATH ${HDF5_ROOT_DIR}/lib)
+ set(CMAKE_PROGRAM_PATH ${HDF5_ROOT_DIR}/bin)
+endif(EXISTS ${HDF5_ROOT_DIR})
+find_package(HDF5 COMPONENTS C REQUIRED)
+if (HDF5_FOUND)
+ set(HDF5_DEFINITIONS "-DH5_USE_16_API ${HDF5_DEFINITIONS}" )
+ if(WINDOWS)
+ set(HDF5_DEFINITIONS "-D_HDF5USEDLL_ ${HDF5_DEFINITIONS}" )
+ endif(WINDOWS)
+endif(HDF5_FOUND)
+++ /dev/null
-# Copyright (C) 2013 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.
-#
-# 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
-#
-
-# LibBatch detection dor Salome
-#
-# !! Please read the generic detection procedure in SalomeMacros.cmake !!
-#
-
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(LibBatch LIBBATCH_ROOT_DIR_EXP 0)
-#MARK_AS_ADVANCED()
+++ /dev/null
-# Copyright (C) 2013 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.
-#
-# 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
-#
-
-# LibXml2 detection for SALOME
-#
-# !! Please read the generic detection procedure in SalomeMacros.cmake !!
-#
-IF(WIN32)
- SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(LibXml2 LIBXML2_INCLUDE_DIR 1)
-ELSE()
- SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(LibXml2 LIBXML2_INCLUDE_DIR 2)
-ENDIF()
-#MARK_AS_ADVANCED()
-
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# Author: Adrien Bruneton
-#
# MPI detection for Salome
-#
-# !! Please read the generic detection procedure in SalomeMacros.cmake !!
-#
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(MPI MPIEXEC 2)
-MARK_AS_ADVANCED(MPI_EXTRA_LIBRARY MPI_LIBRARY)
+set(MPI_ROOT_DIR $ENV{MPI_ROOT_DIR} CACHE PATH "Path to Mpi directory")
+if(EXISTS ${MPI_ROOT_DIR})
+ set(CMAKE_INCLUDE_PATH ${MPI_ROOT_DIR}/include)
+ set(CMAKE_LIBRARY_PATH ${MPI_ROOT_DIR}/lib)
+ set(CMAKE_PROGRAM_PATH ${MPI_ROOT_DIR}/bin)
+endif(EXISTS ${MPI_ROOT_DIR})
+find_package(MPI REQUIRED)
+if(HDF5_IS_PARALLEL)
+ set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS} ${MPI_C_INCLUDE_PATH} ${MPI_CXX_INCLUDE_PATH} )
+ set(HDF5_LIBRARIES ${HDF5_LIBRARIES} ${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES})
+endif(HDF5_IS_PARALLEL)
+++ /dev/null
-# Copyright (C) 2013 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.
-#
-# 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 SALOME
-#
-# !! Please read the generic detection procedure in SalomeMacros.cmake !!
-#
-# 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(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(SalomePython 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 SalomePython module
- # to force the next call to SALOME_FIND_PACKAGE() to find the exact matching
- # version:
- SET(_old_EXACT ${SalomePython_FIND_VERSION_EXACT})
- SET(_old_VERSION "${SalomePython_FIND_VERSION}")
- SET(SalomePython_FIND_VERSION_EXACT TRUE)
- SET(SalomePython_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)
-# SET(PYTHON_LIBRARY ${_tmp}/lib)
-# SET(PYTHON_INCLUDE_DIR ${_tmp}/include)
- SALOME_FIND_PACKAGE(SalomePython PythonLibs MODULE)
- # Restore variables:
- SET(SalomePython_FIND_VERSION_EXACT ${_old_EXACT})
- SET(SalomePython_FIND_VERSION "${_old_VERSION}")
-ENDIF()
-
-# Set the FOUND flag for SalomePython:
-SET(SALOMEPYTHON_FOUND FALSE)
-IF (_found1 AND PYTHONLIBS_FOUND)
- SET(SALOMEPYTHON_FOUND TRUE)
-ENDIF()
-
-IF (SALOMEPYTHON_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. Specifics
- ## None here
-ELSE()
- MESSAGE(STATUS "Python was only partially (or not at all) found .")
-ENDIF()
-
-
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# Author: Adrien Bruneton
-#
-# SWIG detection for SALOME
-#
-# !! Please read the generic detection procedure in SalomeMacros.cmake !!
-#
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 2)
-MARK_AS_ADVANCED(SWIG_EXECUTABLE SWIG_VERSION)
+# Swig detection for Salome
+
+set(SWIG_ROOT_DIR $ENV{SWIG_ROOT_DIR} CACHE PATH "Path to Swig directory")
+if(EXISTS ${SWIG_ROOT_DIR})
+ set(CMAKE_INCLUDE_PATH ${SWIG_ROOT_DIR}/include)
+ set(CMAKE_LIBRARY_PATH ${SWIG_ROOT_DIR}/lib)
+ set(CMAKE_PROGRAM_PATH ${SWIG_ROOT_DIR}/bin)
+endif(EXISTS ${SWIG_ROOT_DIR})
+find_package(SWIG REQUIRED)
+++ /dev/null
-# Copyright (C) 2013 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.
-#
-# 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
-#
-
-# Sphinx detection for Salome
-#
-# !! Please read the generic detection procedure in SalomeMacros.cmake !!
-#
-
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(Sphinx SPHINX_EXECUTABLE 2)
-MARK_AS_ADVANCED(SPHINX_EXECUTABLE)
+++ /dev/null
-# - Sphinx detection
-#
-# Output variable: SPHINX_EXECUTABLE
-#
-# The executable 'sphinx-build' is looked for and returned in the above variable.
-#
-
-###########################################################################
-# Copyright (C) 2007-2013 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.
-#
-# 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
-#
-###########################################################################
-
-FIND_PROGRAM(SPHINX_EXECUTABLE sphinx-build)
-
-# Handle the standard arguments of the find_package() command:
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sphinx REQUIRED_VARS SPHINX_EXECUTABLE)
-
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# Author: A.Geay, V. Sandler, A. Bruneton
-#
#----------------------------------------------------------------------------
# LIST_CONTAINS is a macro useful for determining whether a list has a
INSTALL(FILES ${OUT_FILE} DESTINATION ${SALOME_CONFIGURE_FILE_INSTALL})
ENDIF(SALOME_CONFIGURE_FILE_INSTALL)
ENDMACRO(SALOME_CONFIGURE_FILE)
-
-
-#######################################################################################
-# Useful macros for SALOME own package detection system
-#
-
-###
-# 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("blo / ${CMAKE_PREFIX_PATH} / ${CMAKE_FIND_ROOT_PATH}")
- 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 <referenceVariable>
-# 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.
- STRING(TOLOWER ${pkg} _pkg_lc)
- FIND_PACKAGE(${pkg} NO_MODULE QUIET PATHS "${_CONF_DIR}" "${_CONF_DIR}/${pkg}"
- "${_CONF_DIR}/${_pkg_lc}")
- MARK_AS_ADVANCED(${pkg}_DIR)
-
- IF (NOT (${pkg_UC}_FOUND OR ${pkg}_FOUND))
- # Override the variable - don't append to it, as it would give precedence
- # to what was stored there before!
- 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 "Environment variable ${pkg_UC}_ROOT_DIR is not defined. The system installation was found.")
- 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)
-