From ae1e664d2ab150ae687f4e5afd5e120eb62b5d49 Mon Sep 17 00:00:00 2001 From: mpa Date: Tue, 29 Oct 2013 08:32:59 +0000 Subject: [PATCH] CMake: - Accumulate environment variables, to be used later to run some command in proper environment. --- CMakeLists.txt | 6 ++++++ SalomeSMESHConfig.cmake.in | 3 +++ adm_local/cmake_files/FindSalomeCGNS.cmake | 6 +++++- adm_local/cmake_files/FindSalomeSMESH.cmake | 4 ++++ adm_local/cmake_files/FindSalomeTBB.cmake | 6 +++++- adm_local/cmake_files/FindSalomef2c.cmake | 5 ++++- 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a5353388..ed90b4677 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -240,6 +240,12 @@ MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED) MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC) MARK_AS_ADVANCED(SALOME_SMESH_INSTALL_RES_DATA SALOME_SMESH_INSTALL_PLUGINS) +# Accumulate environment variables for SMESH module +SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS} + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON} + ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED}) +SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS}) + # Sources # ======== diff --git a/SalomeSMESHConfig.cmake.in b/SalomeSMESHConfig.cmake.in index c875e75c0..c4417cb2b 100644 --- a/SalomeSMESHConfig.cmake.in +++ b/SalomeSMESHConfig.cmake.in @@ -46,6 +46,9 @@ SET_AND_CHECK(SMESH_INCLUDE_DIRS "${SMESH_ROOT_DIR_EXP}/@SALOME_INSTALL_HEADERS@ SET(SMESH_INCLUDE_DIRS "${SMESH_INCLUDE_DIRS};@_SalomeSMESH_EXTRA_HEADERS@") SET(SMESH_DEFINITIONS "@GEOM_DEFINITIONS@") +# Package specific environment variables +@_SalomeSMESH_EXTRA_ENV_FULL@ + #### Now the specificities # Options exported by the package: diff --git a/adm_local/cmake_files/FindSalomeCGNS.cmake b/adm_local/cmake_files/FindSalomeCGNS.cmake index 26517fdd4..2974e7312 100644 --- a/adm_local/cmake_files/FindSalomeCGNS.cmake +++ b/adm_local/cmake_files/FindSalomeCGNS.cmake @@ -20,4 +20,8 @@ SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(CGNS CGNS_INCLUDE_DIRS 1) MARK_AS_ADVANCED(CGNS_INCLUDE_DIRS CGNS_LIBRARIES) -SALOME_ACCUMULATE_HEADERS(CGNS_INCLUDE_DIRS) +IF(CGNS_FOUND) + SALOME_ACCUMULATE_HEADERS(CGNS_INCLUDE_DIRS) + SALOME_ACCUMULATE_ENVIRONMENT(PATH ${CGNS_ROOT_DIR}/bin) + SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${CGNS_ROOT_DIR}/lib) +ENDIF() \ No newline at end of file diff --git a/adm_local/cmake_files/FindSalomeSMESH.cmake b/adm_local/cmake_files/FindSalomeSMESH.cmake index c316f9da8..ac29b1a92 100644 --- a/adm_local/cmake_files/FindSalomeSMESH.cmake +++ b/adm_local/cmake_files/FindSalomeSMESH.cmake @@ -29,3 +29,7 @@ SALOME_FIND_PACKAGE(SalomeSMESH SalomeSMESH CONFIG) IF(NOT SalomeSMESH_FIND_QUIETLY) MESSAGE(STATUS "Found Salome SMESH: ${SMESH_ROOT_DIR}") ENDIF() + +FOREACH(_res ${SalomeSMESH_EXTRA_ENV}) + SALOME_ACCUMULATE_ENVIRONMENT(${_res} "${SalomeSMESH_EXTRA_ENV_${_res}}") +ENDFOREACH() \ No newline at end of file diff --git a/adm_local/cmake_files/FindSalomeTBB.cmake b/adm_local/cmake_files/FindSalomeTBB.cmake index 2b9dcd5ba..65b2851c9 100644 --- a/adm_local/cmake_files/FindSalomeTBB.cmake +++ b/adm_local/cmake_files/FindSalomeTBB.cmake @@ -20,4 +20,8 @@ SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(TBB TBB_INCLUDE_DIRS 2) MARK_AS_ADVANCED(TBB_INCLUDE_DIRS TBB_LIBRARIES) -SALOME_ACCUMULATE_HEADERS(TBB_INCLUDE_DIRS) +IF(TBB_FOUND) + SALOME_ACCUMULATE_HEADERS(TBB_INCLUDE_DIRS) + SALOME_ACCUMULATE_ENVIRONMENT(PATH ${TBB_ROOT_DIR}/bin/intel64/cc4.1.0_libc2.4_kernel2.6.16.21) + SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${TBB_LIBRARIES}) +ENDIF() \ No newline at end of file diff --git a/adm_local/cmake_files/FindSalomef2c.cmake b/adm_local/cmake_files/FindSalomef2c.cmake index 1478d2dc0..dcaf89366 100755 --- a/adm_local/cmake_files/FindSalomef2c.cmake +++ b/adm_local/cmake_files/FindSalomef2c.cmake @@ -20,4 +20,7 @@ SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(f2c f2c_INCLUDE_DIRS 0) MARK_AS_ADVANCED(F2C_INCLUDE_DIRS F2C_LIBRARIES F2C_GENERATOR) -SALOME_ACCUMULATE_HEADERS(F2C_INCLUDE_DIRS) \ No newline at end of file +IF(F2C_FOUND) + SALOME_ACCUMULATE_HEADERS(F2C_INCLUDE_DIRS) + SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH ${F2C_LIBRARIES}) +ENDIF() \ No newline at end of file -- 2.39.2