From 880d79f632721b2c20ce0151c60f89a3726015a6 Mon Sep 17 00:00:00 2001 From: michael Date: Sat, 26 Sep 2020 12:23:47 +0200 Subject: [PATCH] Impproved detection of paraview by salome --- CDMATH/CMakeLists.txt | 2 +- CMakeLists.txt | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CDMATH/CMakeLists.txt b/CDMATH/CMakeLists.txt index 758a4e3..3ac2251 100755 --- a/CDMATH/CMakeLists.txt +++ b/CDMATH/CMakeLists.txt @@ -87,7 +87,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg -fprofile-arcs -ftest-co if (CMAKE_BUILD_TYPE STREQUAL "Debug") SET(CMAKE_EXE_LINKER_FLAGS "-pg -fprofile-arcs -ftest-coverage -lgcov") SET(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage") -endif(${CMAKE_BUILD_TYPE} STREQUAL "Debug") +endif(CMAKE_BUILD_TYPE STREQUAL "Debug") # Tests if (CDMATH_WITH_TESTS) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f6066c..bc4f832 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -354,22 +354,29 @@ endif(TARGET PETSc AND TARGET MEDCoupling) # Final operations # #################### -# Paraview variables for env_SOLVERLAB.sh +# Paraview variables to choose python version and for env_SOLVERLAB.sh if ( DEFINED PARAVIEW_VERSION ) message(STATUS "ParaView version is ${PARAVIEW_VERSION}" ) else( DEFINED PARAVIEW_VERSION ) - if( DEFINED PARAVIEW_ROOT_DIR) + if ( DEFINED PARAVIEW_ROOT_DIR) set( PARAVIEW_INCLUDE_DIR ${PARAVIEW_ROOT_DIR}/include) set( PARAVIEW_LIBRARIES_DIR ${PARAVIEW_ROOT_DIR}/lib) else( DEFINED PARAVIEW_ROOT_DIR) - message(WARNING "PARAVIEW_VERSION and PARAVIEW_ROOT_DIR not set. Trying to find paraview in the system.") + message(STATUS "PARAVIEW_VERSION and PARAVIEW_ROOT_DIR not set. Trying to find paraview in the system.") set( PARAVIEW_INCLUDE_DIR /usr/include/paraview/) set( PARAVIEW_LIBRARIES_DIR /usr/lib/paraview/:/usr/lib64/paraview/:/usr/lib64/vtk/:/usr/lib/vtk/) endif( DEFINED PARAVIEW_ROOT_DIR) + set( PARAVIEW_SUFFIXES paraview-5.0 paraview-5.1 paraview-5.2 paraview-5.3 paraview-5.4 paraview-5.5 paraview-5.6 paraview-5.7 paraview-5.8 paraview-5.9 ) + find_file( vtkConfig_file vtkPVConfig.h HINTS ${PARAVIEW_INCLUDE_DIR} PATH_SUFFIXES ${PARAVIEW_SUFFIXES}) + #extraction of the paraview version" - IF ( EXISTS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h ) - file(STRINGS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h vtkConfig) + IF ( ${vtkConfig_file} STREQUAL "vtkConfig_file-NOTFOUND" ) + message(WARNING "Could not find ParaView configuration file vtkPVConfig.h in folder ${PARAVIEW_INCLUDE_DIR} and subdirectories ${PARAVIEW_SUFFIXES}. Postprocessing may not work") + set( PARAVIEW_VERSION "5.0") + ELSE ( ${vtkConfig_file} STREQUAL "vtkConfig_file-NOTFOUND" ) + message( STATUS "find_file a trouvé vtkPVConfig.h dans ${vtkConfig_file}") + file(STRINGS ${vtkConfig_file} vtkConfig) FOREACH(line ${vtkConfig}) string(FIND "${line}" "#define PARAVIEW_VERSION_FULL " pos) IF(NOT ${pos} EQUAL -1) @@ -378,12 +385,9 @@ else( DEFINED PARAVIEW_VERSION ) string(SUBSTRING ${line} ${start_pv_version} 5 PARAVIEW_VERSION) break() ENDIF(NOT ${pos} EQUAL -1) - ENDFOREACH(line vtkConfig) + ENDFOREACH(line ${vtkConfig}) message(STATUS "ParaView found, version is ${PARAVIEW_VERSION}" ) - ELSE ( EXISTS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h ) - message(WARNING "Could not find ParaView configuration file vtkPVConfig.h in folder ${PARAVIEW_INCLUDE_DIR}. Postprocessing may not work") - set( PARAVIEW_VERSION "5.0") - ENDIF( EXISTS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h ) + ENDIF( ${vtkConfig_file} STREQUAL "vtkConfig_file-NOTFOUND" ) endif( DEFINED PARAVIEW_VERSION) -- 2.39.2