Skip to content
Snippets Groups Projects
Commit 5cbd6092 authored by Simon Praetorius's avatar Simon Praetorius
Browse files

Fix cmake bug when Scotch is found but not PTScotch

parent 6bb97962
No related branches found
No related tags found
1 merge request!988Fix cmake bug when Scotch is found but not PTScotch
Pipeline #38489 passed
Pipeline: Dune Nightly Test

#38490

    ......@@ -15,12 +15,20 @@ include_guard(GLOBAL)
    set(HAVE_PTSCOTCH ${PTScotch_FOUND})
    # register all PTScotch related flags
    if(PTScotch_FOUND)
    if(PTScotch_SCOTCH_FOUND)
    dune_register_package_flags(LIBRARIES PTScotch::Scotch)
    endif()
    if(PTScotch_PTSCOTCH_FOUND)
    dune_register_package_flags(LIBRARIES PTScotch::PTScotch)
    endif()
    function(add_dune_ptscotch_flags _targets)
    if(PTScotch_FOUND)
    if(PTScotch_SCOTCH_FOUND)
    foreach(_target ${_targets})
    target_link_libraries(${_target} PUBLIC PTScotch::Scotch)
    endforeach(_target ${_targets})
    endif()
    if(PTScotch_PTSCOTCH_FOUND)
    foreach(_target ${_targets})
    target_link_libraries(${_target} PUBLIC PTScotch::PTScotch)
    endforeach(_target ${_targets})
    ......
    ......@@ -110,9 +110,9 @@ mark_as_advanced(METIS_INCLUDE_DIR METIS_LIBRARY METIS_NEEDS_LIBM METIS_API_VERS
    # Scotch provides METIS-3 interface only in version < 6.07, but provides an option to
    # select the API-version in later Scotch releases
    if(IS_SCOTCH_METIS_HEADER)
    find_package(PTScotch COMPONENTS SCOTCH)
    set(HAVE_SCOTCH_METIS ${PTScotch_FOUND})
    if (PTScotch_FOUND AND NOT METIS_API_VERSION)
    find_package(PTScotch)
    set(HAVE_SCOTCH_METIS ${PTScotch_SCOTCH_FOUND})
    if (PTScotch_SCOTCH_FOUND AND NOT METIS_API_VERSION)
    if(PTScotch_VERSION VERSION_LESS "6.0.7")
    set(METIS_API_VERSION "3")
    else()
    ......
    ......@@ -160,7 +160,7 @@ if(PTScotch_FOUND)
    endif()
    # Define an imported target for the parallel PTScotch library
    if(PTScotch_PTSCOTCH_FOUND AND NOT TARGET PTScotch::PTScotch)
    if(PTScotch_SCOTCH_FOUND AND PTScotch_PTSCOTCH_FOUND AND NOT TARGET PTScotch::PTScotch)
    add_library(PTScotch::PTScotch UNKNOWN IMPORTED)
    set_target_properties(PTScotch::PTScotch PROPERTIES
    IMPORTED_LOCATION ${PTSCOTCH_LIBRARY}
    ......
    ......@@ -91,9 +91,9 @@ set(PARMETIS_DEPENDENCIES METIS_FOUND MPI_FOUND)
    # If ptscotch-parmetis is requested, find package PTScotch
    if(IS_PTSCOTCH_PARMETIS_HEADER)
    find_package(PTScotch COMPONENTS PTSCOTCH)
    set(HAVE_PTSCOTCH_PARMETIS ${PTScotch_FOUND})
    list(APPEND PARMETIS_DEPENDENCIES PTScotch_FOUND)
    find_package(PTScotch)
    set(HAVE_PTSCOTCH_PARMETIS ${PTScotch_PTSCOTCH_FOUND})
    list(APPEND PARMETIS_DEPENDENCIES PTScotch_PTSCOTCH_FOUND)
    endif()
    # behave like a CMake module is supposed to behave
    ......@@ -116,7 +116,7 @@ if(PARMETIS_FOUND AND NOT TARGET ParMETIS::ParMETIS)
    )
    # link against PTScotch if needed
    if(IS_PTSCOTCH_PARMETIS_HEADER AND PTScotch_FOUND)
    if(IS_PTSCOTCH_PARMETIS_HEADER AND PTScotch_PTSCOTCH_FOUND)
    set_property(TARGET ParMETIS::ParMETIS APPEND PROPERTY
    INTERFACE_LINK_LIBRARIES PTScotch::PTScotch)
    endif()
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment