diff --git a/CMakeLists.txt b/CMakeLists.txt index fa0915d5a914382f10d949dcf4907780f0a27403..34649a17b5100153dd34021648367d22f690e388 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -624,9 +624,9 @@ if(ENABLE_PETSC) list(APPEND EXTERNAL_INCLUDES ${ENV_PETSC_DIR}/${ENV_PETSC_ARCH}/include) string(REGEX MATCH "PACKAGES_INCLUDES = [^\n\r]*" PETSC_PACKAGES_INCLUDES ${PETSC_VARIABLES}) - string(REPLACE "PACKAGES_INCLUDES = " "" PETSC_PACKAGES_INCLUDES - ${PETSC_PACKAGES_INCLUDES}) if(PETSC_PACKAGES_INCLUDES) + string(REPLACE "PACKAGES_INCLUDES = " "" PETSC_PACKAGES_INCLUDES + ${PETSC_PACKAGES_INCLUDES}) string(REPLACE "-I" "" PETSC_PACKAGES_INCLUDES ${PETSC_PACKAGES_INCLUDES}) string(REPLACE " " ";" PETSC_PACKAGES_INCLUDES ${PETSC_PACKAGES_INCLUDES}) foreach(VAR ${PETSC_PACKAGES_INCLUDES}) @@ -654,13 +654,17 @@ if(ENABLE_PETSC) list(APPEND EXTERNAL_LIBRARIES ${PETSC_LIBS}) # find additional libraries to link with string(REGEX MATCH "PACKAGES_LIBS = [^\n\r]*" PLIBS ${PETSC_VARIABLES}) - string(REPLACE "PACKAGES_LIBS = " "" PLIBS ${PLIBS}) - string(STRIP ${PLIBS} PLIBS) - list(APPEND EXTERNAL_LIBRARIES "${PLIBS}") + if(PLIBS) + string(REPLACE "PACKAGES_LIBS = " "" PLIBS ${PLIBS}) + string(STRIP ${PLIBS} PLIBS) + list(APPEND EXTERNAL_LIBRARIES "${PLIBS}") + endif(PLIBS) string(REGEX MATCH "PCC_LINKER_LIBS = [^\n\r]*" LLIBS ${PETSC_VARIABLES}) - string(REPLACE "PCC_LINKER_LIBS = " "" LLIBS ${LLIBS}) - string(STRIP ${LLIBS} LLIBS) - list(APPEND EXTERNAL_LIBRARIES "${LLIBS}") + if(LLIBS) + string(REPLACE "PCC_LINKER_LIBS = " "" LLIBS ${LLIBS}) + string(STRIP ${LLIBS} LLIBS) + list(APPEND EXTERNAL_LIBRARIES "${LLIBS}") + endif(LLIBS) endif(EXISTS ${ENV_PETSC_DIR}/${ENV_PETSC_ARCH}/conf/petscvariables) endif(ENABLE_PETSC)