-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathfindnetcdf.patch
More file actions
66 lines (59 loc) · 2.45 KB
/
findnetcdf.patch
File metadata and controls
66 lines (59 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
--- a/VTK/CMake/FindNetCDF.cmake
+++ b/VTK/CMake/FindNetCDF.cmake
@@ -38,17 +38,26 @@ if (NETCDF_INCLUDE_DIR AND NETCDF_LIBRARY)
set (NETCDF_FIND_QUIETLY TRUE)
endif ()
+set(USE_DEFAULT_PATHS "NO_DEFAULT_PATH")
+if(NETCDF_USE_DEFAULT_PATHS)
+ set(USE_DEFAULT_PATHS "")
+endif()
+
find_path (NETCDF_INCLUDE_DIR netcdf.h
- HINTS NETCDF_DIR ENV NETCDF_DIR)
+ HINTS "${NETCDF_DIR}/include")
mark_as_advanced (NETCDF_INCLUDE_DIR)
set (NETCDF_C_INCLUDE_DIRS ${NETCDF_INCLUDE_DIR})
-find_library (NETCDF_LIBRARY NAMES netcdf)
+find_library (NETCDF_LIBRARY NAMES netcdf
+ HINTS "${NETCDF_DIR}/lib")
mark_as_advanced (NETCDF_LIBRARY)
+
set (NETCDF_C_LIBRARIES ${NETCDF_LIBRARY})
#start finding requested language components
set (NetCDF_libs "")
+set (netCDF_includes "${NETCDF_INCLUDE_DIR}")
+
get_filename_component (NetCDF_lib_dirs "${NETCDF_LIBRARY}" PATH)
set (NETCDF_HAS_INTERFACES "YES") # will be set to NO if we're missing any interfaces
@@ -56,9 +65,15 @@ macro (NetCDF_check_interface lang header libs)
if (NETCDF_${lang})
#search starting from user modifiable cache var
find_path (NETCDF_${lang}_INCLUDE_DIR NAMES ${header}
- HINTS "${NETCDF_INCLUDE_DIR}" NO_DEFAULT_PATH)
+ HINTS "${NETCDF_INCLUDE_DIR}"
+ HINTS "${NETCDF_${lang}_ROOT}/include"
+ ${USE_DEFAULT_PATHS})
+
find_library (NETCDF_${lang}_LIBRARY NAMES ${libs}
- HINTS "${NetCDF_lib_dirs}" NO_DEFAULT_PATH)
+ HINTS "${NetCDF_lib_dirs}"
+ HINTS "${NETCDF_${lang}_ROOT}/lib"
+ ${USE_DEFAULT_PATHS})
+
mark_as_advanced (NETCDF_${lang}_INCLUDE_DIR NETCDF_${lang}_LIBRARY)
#export to internal varS that rest of project can use directly
@@ -67,6 +82,7 @@ macro (NetCDF_check_interface lang header libs)
if (NETCDF_${lang}_INCLUDE_DIR AND NETCDF_${lang}_LIBRARY)
list (APPEND NetCDF_libs ${NETCDF_${lang}_LIBRARY})
+ list (APPEND netCDF_includes ${NETCDF_${lang}_INCLUDE_DIR})
else ()
set (NETCDF_HAS_INTERFACES "NO")
message (STATUS "Failed to find NetCDF interface for ${lang}")
@@ -93,7 +109,7 @@ NetCDF_check_interface (F90 netcdf.mod netcdff)
#export accumulated results to internal varS that rest of project can depend on
list (APPEND NetCDF_libs "${NETCDF_C_LIBRARIES}")
set (NETCDF_LIBRARIES ${NetCDF_libs})
-set (NETCDF_INCLUDE_DIRS ${NETCDF_INCLUDE_DIR})
+set (NETCDF_INCLUDE_DIRS ${netCDF_includes})
# handle the QUIETLY and REQUIRED arguments and set NETCDF_FOUND to TRUE if
# all listed variables are TRUE