simplified

This commit is contained in:
Martin Diehl 2021-05-19 17:31:59 +02:00
parent d4f439ae8b
commit 3cf2ea1749
1 changed files with 10 additions and 18 deletions

View File

@ -16,26 +16,18 @@ if (PETSC_DIR STREQUAL "")
message (FATAL_ERROR "PETSc location (PETSC_DIR) is not defined")
endif ()
file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" petsc_external_lib REGEX "PETSC_WITH_EXTERNAL_LIB = .*$?")
string (REPLACE "=" ";" petsc_external_lib "${petsc_external_lib}")
list (GET petsc_external_lib 1 petsc_external_lib)
string (REGEX MATCHALL "-[lLW]([^\" ]+)" TMP_LIST "${petsc_external_lib}")
list (REMOVE_DUPLICATES TMP_LIST)
foreach (exlib ${TMP_LIST})
set (PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB} ${exlib}")
endforeach (exlib)
file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" PETSC_EXTERNAL_LIB REGEX "PETSC_WITH_EXTERNAL_LIB = .*$?")
string (REGEX MATCHALL "-[lLW]([^\" ]+)" PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}")
list (REMOVE_DUPLICATES PETSC_EXTERNAL_LIB)
string (REPLACE ";" " " PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB}")
file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" petsc_includes REGEX "PETSC_FC_INCLUDES = .*$?")
string (REPLACE "=" ";" petsc_includes "${petsc_includes}")
list (GET petsc_includes 1 petsc_includes)
string (REGEX MATCHALL "-I([^\" ]+)" TMP_LIST "${petsc_includes}")
list (REMOVE_DUPLICATES TMP_LIST)
foreach (dir ${TMP_LIST})
set (PETSC_INCLUDES "${PETSC_INCLUDES} ${dir}")
endforeach (dir)
file (STRINGS "${PETSC_DIR}/lib/petsc/conf/petscvariables" PETSC_INCLUDES REGEX "PETSC_FC_INCLUDES = .*$?")
string (REGEX MATCHALL "-I([^\" ]+)" PETSC_INCLUDES "${PETSC_INCLUDES}")
list (REMOVE_DUPLICATES PETSC_INCLUDES)
string (REPLACE ";" " " PETSC_INCLUDES "${PETSC_INCLUDES}")
message ("PETSC_DIR:\n${PETSC_DIR}\n" )
message ("PETSC_INCLUDES:\n${PETSC_INCLUDES}\n" )
message ("PETSC_DIR:\n${PETSC_DIR}\n")
message ("PETSC_INCLUDES:\n${PETSC_INCLUDES}\n")
message ("PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n")
#---------------------------------------------------------------------------------------