diff --git a/modules/find/FindPTSCOTCH.cmake b/modules/find/FindPTSCOTCH.cmake index 37e9b80c6e5fd97ee2c7fd319cb2647762e30f78..b13259f52e26ad1290762a2fa93e4be7b90aee15 100644 --- a/modules/find/FindPTSCOTCH.cmake +++ b/modules/find/FindPTSCOTCH.cmake @@ -32,6 +32,7 @@ # - MPI # # COMPONENTS can be some of the following: +# - ERREXIT: to choose libptscotcherrexit as error library instead of libptscotcherr (default) # - ESMUMPS: to activate detection of PT-Scotch with the esmumps interface # # This module finds headers and ptscotch library. @@ -70,10 +71,15 @@ include(FindMorseInit) morse_find_package_get_envdir(PTSCOTCH) # Set the version to find +set(PTSCOTCH_LOOK_FOR_ERREXIT OFF) set(PTSCOTCH_LOOK_FOR_ESMUMPS OFF) if( PTSCOTCH_FIND_COMPONENTS ) foreach( component ${PTSCOTCH_FIND_COMPONENTS} ) + if (${component} STREQUAL "ERREXIT") + # means we look for ptscotcherrexit library + set(PTSCOTCH_LOOK_FOR_ERREXIT ON) + endif() if (${component} STREQUAL "ESMUMPS") # means we look for esmumps library set(PTSCOTCH_LOOK_FOR_ESMUMPS ON) @@ -107,12 +113,15 @@ morse_find_path(PTSCOTCH # Looking for lib # --------------- -set(PTSCOTCH_libs_to_find "ptscotch;ptscotcherr") +if (PTSCOTCH_LOOK_FOR_ERREXIT) + list(APPEND PTSCOTCH_libs_to_find "ptscotch;ptscotcherrexit;scotch;scotcherrexit") +else() + list(APPEND PTSCOTCH_libs_to_find "ptscotch;ptscotcherr;scotch;scotcherr") +endif() if (PTSCOTCH_LOOK_FOR_ESMUMPS) list(INSERT PTSCOTCH_libs_to_find 0 "ptesmumps") list(APPEND PTSCOTCH_libs_to_find "esmumps" ) endif() -list(APPEND PTSCOTCH_libs_to_find "scotch;scotcherr") morse_find_library(PTSCOTCH LIBRARIES ${PTSCOTCH_libs_to_find} diff --git a/modules/find/FindSCOTCH.cmake b/modules/find/FindSCOTCH.cmake index 6dfb1b1f9581ad870977140968f07eb5dd58159e..5cb20659a89a9c57de9b5935f7447c88efcc25cc 100644 --- a/modules/find/FindSCOTCH.cmake +++ b/modules/find/FindSCOTCH.cmake @@ -28,6 +28,7 @@ # ) # # COMPONENTS can be some of the following: +# - ERREXIT: to choose libscotcherrexit as error library instead of libscotcherr (default) # - ESMUMPS: to activate detection of Scotch with the esmumps interface # # This module finds headers and scotch library. @@ -64,10 +65,15 @@ include(FindMorseInit) morse_find_package_get_envdir(SCOTCH) # Set the version to find +set(SCOTCH_LOOK_FOR_ERREXIT OFF) set(SCOTCH_LOOK_FOR_ESMUMPS OFF) if( SCOTCH_FIND_COMPONENTS ) foreach( component ${SCOTCH_FIND_COMPONENTS} ) + if (${component} STREQUAL "ERREXIT") + # means we look for scotcherrexit library + set(SCOTCH_LOOK_FOR_ERREXIT ON) + endif() if (${component} STREQUAL "ESMUMPS") # means we look for esmumps library set(SCOTCH_LOOK_FOR_ESMUMPS ON) @@ -94,7 +100,11 @@ morse_find_path(SCOTCH # Looking for lib # --------------- -set(SCOTCH_libs_to_find "scotch;scotcherrexit") +if (SCOTCH_LOOK_FOR_ERREXIT) + list(APPEND SCOTCH_libs_to_find "scotch;scotcherrexit") +else() + list(APPEND SCOTCH_libs_to_find "scotch;scotcherr") +endif() if (SCOTCH_LOOK_FOR_ESMUMPS) list(INSERT SCOTCH_libs_to_find 0 "esmumps") endif() @@ -131,7 +141,9 @@ if(SCOTCH_LIBRARIES) list(APPEND REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}") list(APPEND REQUIRED_LDFLAGS "${CMAKE_THREAD_LIBS_INIT}") else() - list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}") + if (CMAKE_THREAD_LIBS_INIT) + list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}") + endif() endif() set(Z_LIBRARY "Z_LIBRARY-NOTFOUND") find_library(Z_LIBRARY NAMES z)