Alpine3D

Alpine3D Svn Source Tree

Root/trunk/tools/cmake/FindMeteoIO.cmake

1INCLUDE(LibFindMacros)
2
3# Where can we find something that looks like a MeteoIO source tree?
4FILE(GLOB mio_local_src LIST_DIRECTORIES TRUE ../[mM]eteo[iI][oO] ../../../[mM]eteo[iI][oO] ../[mM]eteo[iI][oO]-[0-9]* ../../../[mM]eteo[iI][oO]-[0-9]*)
5LIST(LENGTH mio_local_src n)
6IF("${n}" EQUAL "0")
7SET(SRC_DIR ".")
8ELSE("${n}" EQUAL "0")
9LIST(GET mio_local_src 0 SRC_DIR) #only keep the first match
10ENDIF("${n}" EQUAL "0")
11
12IF(WIN32)
13GET_FILENAME_COMPONENT(METEOIO_ROOT1 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeteoIO;UninstallString]" PATH CACHE INTERNAL)
14GET_FILENAME_COMPONENT(METEOIO_ROOT2 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MeteoIO;UninstallString]" PATH CACHE INTERNAL)
15GET_FILENAME_COMPONENT(METEOIO_ROOT3 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WSL Institute for Snow and Avalanche Research\\MeteoIO]" ABSOLUTE CACHE INTERNAL)
16GET_FILENAME_COMPONENT(METEOIO_ROOT4 "C:/Progra~1/MeteoI*" ABSOLUTE CACHE INTERNAL)
17SET(SEARCH_PATH
18ENV LIB
19./lib ./bin
20./lib/Debug ./bin/Debug
21./lib/Release ./bin/Release
22../../lib ../../bin
23../../lib/Debug ../../bin/Debug
24../../lib/Release ../../bin/Release
25${SRC_DIR}/lib ${SRC_DIR}/bin
26${SRC_DIR}/lib/Debug ${SRC_DIR}/bin/Debug
27${SRC_DIR}/lib/Release ${SRC_DIR}/bin/Release
28${SRC_DIR}/../../lib ${SRC_DIR}/../../bin
29${SRC_DIR}/../../lib/Debug ${SRC_DIR}/../../bin/Debug
30${SRC_DIR}/../../lib/Release ${SRC_DIR}/../../bin/Release
31${SRC_DIR}/bin ${SRC_DIR}/lib
32${METEOIO_ROOT1}/bin ${METEOIO_ROOT1}/lib
33${METEOIO_ROOT2}/bin ${METEOIO_ROOT2}/lib
34${METEOIO_ROOT3}/bin ${METEOIO_ROOT3}/lib
35${METEOIO_ROOT4}/bin ${METEOIO_ROOT4}/lib)
36IF(MSVC)
37FIND_LIBRARY(METEOIO_LIBRARY
38NAMES libmeteoio.lib
39HINTS ${SEARCH_PATH}
40DOC "Location of the libmeteoio, like c:/Program Files/MeteoIO-2.4.0/lib/libmeteoio.lib"
41)
42ELSE(MSVC)
43FIND_LIBRARY(METEOIO_LIBRARY
44NAMES libmeteoio.dll.a libmeteoio.a
45HINTS ${SEARCH_PATH}
46DOC "Location of the libmeteoio, like c:/Program Files/MeteoIO-2.4.0/lib/libmeteoio.dll.a"
47)
48ENDIF(MSVC)
49ELSE(WIN32)
50IF(APPLE)
51FIND_LIBRARY(METEOIO_LIBRARY
52NAMES meteoio
53HINTS
54ENV LD_LIBRARY_PATH
55ENV DYLD_FALLBACK_LIBRARY_PATH
56./lib
57../../lib
58../../../lib
59${SRC_DIR}/lib
60"~/usr/lib"
61"/Applications/MeteoIO/lib"
62"/usr/local/lib"
63"/usr/lib"
64"/opt/lib"
65DOC "Location of the libmeteoio, like /usr/lib/libmeteoio.dylib"
66)
67ELSE(APPLE)
68FIND_LIBRARY(METEOIO_LIBRARY
69NAMES meteoio
70HINTS
71ENV LD_LIBRARY_PATH
72./lib
73../../lib
74../../../lib
75${SRC_DIR}/lib
76"~/usr/lib"
77"/usr/local/lib"
78"/usr/lib"
79"/opt/lib"
80DOC "Location of the libmeteoio, like /usr/lib/libmeteoio.so"
81)
82ENDIF(APPLE)
83ENDIF(WIN32)
84
85IF(METEOIO_LIBRARY)
86#build METEOIO_ROOT so we can provide a hint for searching for the header file
87IF(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
88GET_FILENAME_COMPONENT(METEOIO_ROOT ${METEOIO_LIBRARY} DIRECTORY) #get PATH
89GET_FILENAME_COMPONENT(MSVC_TARGET ${METEOIO_ROOT} NAME) #special directory name for some MSVC
90IF(("${MSVC_TARGET}" STREQUAL "Debug") OR ("${MSVC_TARGET}" STREQUAL "Release"))
91GET_FILENAME_COMPONENT(METEOIO_ROOT ${METEOIO_ROOT} DIRECTORY) #go up one level
92ENDIF(("${MSVC_TARGET}" STREQUAL "Debug") OR ("${MSVC_TARGET}" STREQUAL "Release"))
93GET_FILENAME_COMPONENT(METEOIO_ROOT ${METEOIO_ROOT} DIRECTORY) #go up one level
94ELSE(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
95GET_FILENAME_COMPONENT(meteoio_libs_root ${METEOIO_LIBRARY} PATH)
96SET(METEOIO_ROOT "${meteoio_libs_root}/../")
97STRING(REPLACE " " "\\ " METEOIO_ROOT ${METEOIO_ROOT})
98ENDIF(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
99
100# locate main header file
101FIND_PATH(METEOIO_INCLUDE_DIR
102NAMES meteoio/MeteoIO.h
103HINTS
104"${METEOIO_ROOT}/include"
105"${METEOIO_ROOT}"
106"~/usr/include"
107"/usr/local/include"
108"/usr/include"
109"/opt/include"
110DOC "Location of the meteoio headers, like /usr/include"
111)
112ENDIF(METEOIO_LIBRARY)
113
114# Set the include dir variables and the libraries and let libfind_process do the rest.
115# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
116SET(METEOIO_PROCESS_INCLUDES METEOIO_INCLUDE_DIR)
117SET(METEOIO_PROCESS_LIBS METEOIO_LIBRARY)
118libfind_process(METEOIO)

Archive Download this file

Revision: HEAD