15
15
 
include (LibFind)
16
16
 
17
17
 
# Define SZIP package
18
18
 
define_package_component (SZIP
19
19
 
                          INCLUDE_NAMES szlib.h
20
20
 
                          LIBRARY_NAMES sz)
21
21
 
22
22
 
# SEARCH FOR PACKAGE
23
23
 
if (NOT SZIP_FOUND)
24
24
 
25
 
-
    # Manually add the MPI include and library dirs to search paths
 
25
+
    # Manually add the MPI include and library dirs to search paths 
 
26
+
    # and search for the package component
26
27
 
    if (MPI_C_FOUND)
27
 
-
        set (SZIP_PATHS ${MPI_C_INCLUDE_PATH})
28
 
-
        foreach (lib IN LISTS MPI_C_LIBRARIES)
29
 
-
            get_filename_component (libdir ${lib} PATH)
30
 
-
            list (APPEND SZIP_PATHS ${libdir})
31
 
-
            unset (libdir)
32
 
-
        endforeach ()
 
28
+
        initialize_paths (SZIP_PATHS
 
29
+
                          INCLUDE_DIRECTORIES ${MPI_C_INCLUDE_PATH}
 
30
+
                          LIBRARIES ${MPI_C_LIBRARIES})
 
31
+
        find_package_component(SZIP
 
32
+
                               PATHS ${SZIP_PATHS})
 
33
+
    else ()
 
34
+
        find_package_component(SZIP)
33
35
 
    endif ()
34
 
-
    
35
 
-
    # Search for the package
36
 
-
    find_package_component(SZIP
37
 
-
                           PATHS ${SZIP_PATHS})
38
36
 
39
37
 
endif ()