Alpine3D

Alpine3D Svn Source Tree

Root/trunk/tools/cmake/FindLibsnowpack.cmake

1INCLUDE(LibFindMacros)
2
3# Where can we find something that looks like a Snowpack source tree?
4FILE(GLOB sn_local_src LIST_DIRECTORIES TRUE ../[sS]nowpack ../../../[sS]nowpack ../[sS]nowpack-[0-9]* ../../../[sS]nowpack-[0-9]*)
5LIST(LENGTH sn_local_src n)
6IF("${n}" EQUAL "0")
7SET(SRC_DIR ".")
8ELSE("${n}" EQUAL "0")
9LIST(GET sn_local_src 0 SRC_DIR) #only keep the first match
10ENDIF("${n}" EQUAL "0")
11
12IF(WIN32)
13GET_FILENAME_COMPONENT(LIBSNOWPACK_ROOT1 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Snowpack;UninstallString]" PATH CACHE INTERNAL)
14GET_FILENAME_COMPONENT(LIBSNOWPACK_ROOT2 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Snowpack;UninstallString]" PATH CACHE INTERNAL)
15GET_FILENAME_COMPONENT(LIBSNOWPACK_ROOT3 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WSL Institute for Snow and Avalanche Research\\Snowpack]" ABSOLUTE CACHE INTERNAL)
16GET_FILENAME_COMPONENT(METEOIO_ROOT4 "C:/Progra~1/Snowpack*" 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${LIBSNOWPACK_ROOT1}/bin ${LIBSNOWPACK_ROOT1}/lib
33${LIBSNOWPACK_ROOT2}/bin ${LIBSNOWPACK_ROOT2}/lib
34${LIBSNOWPACK_ROOT3}/bin ${LIBSNOWPACK_ROOT3}/lib
35${LIBSNOWPACK_ROOT4}/bin ${LIBSNOWPACK_ROOT4}/lib )
36
37IF(MSVC)
38FIND_LIBRARY(LIBSNOWPACK_LIBRARY
39NAMES libsnowpack.lib
40HINTS ${SEARCH_PATH}
41DOC "Location of the libsnowpack, like c:/Program Files/Snowpack-2.0.0/lib/libsnowpack.lib"
42)
43ELSE(MSVC)
44FIND_LIBRARY(LIBSNOWPACK_LIBRARY
45NAMES libsnowpack.dll.a libsnowpack.a
46HINTS ${SEARCH_PATH}
47DOC "Location of the libsnowpack, like c:/Program Files/Snowpack-2.0.0/lib/libsnowpack.dll.a"
48)
49ENDIF(MSVC)
50ELSE(WIN32)
51IF(APPLE)
52FIND_LIBRARY(LIBSNOWPACK_LIBRARY
53NAMES snowpack
54HINTS
55ENV LD_LIBRARY_PATH
56ENV DYLD_FALLBACK_LIBRARY_PATH
57./lib
58../../lib
59../../../lib
60${SRC_DIR}/lib
61"~/usr/lib"
62"/Applications/Snowpack/lib"
63"/usr/local/lib"
64"/usr/lib"
65"/opt/lib"
66DOC "Location of the libsnowpack, like /usr/lib/libsnowpack.dylib"
67)
68ELSE(APPLE)
69FIND_LIBRARY(LIBSNOWPACK_LIBRARY
70NAMES snowpack
71HINTS
72ENV LD_LIBRARY_PATH
73./lib
74../../lib
75../../../lib
76${SRC_DIR}/lib
77"~/usr/lib"
78"/usr/local/lib"
79"/usr/lib"
80"/opt/lib"
81DOC "Location of the libsnowpack, like /usr/lib/libsnowpack.so"
82)
83ENDIF(APPLE)
84ENDIF(WIN32)
85
86IF(LIBSNOWPACK_LIBRARY)
87#build LIBSNOWPACK_ROOT so we can provide a hint for searching for the header file
88IF(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
89GET_FILENAME_COMPONENT(LIBSNOWPACK_ROOT ${LIBSNOWPACK_LIBRARY} DIRECTORY) #get PATH
90GET_FILENAME_COMPONENT(MSVC_TARGET ${LIBSNOWPACK_ROOT} NAME) #special directory name for some MSVC
91IF(("${MSVC_TARGET}" STREQUAL "Debug") OR ("${MSVC_TARGET}" STREQUAL "Release"))
92GET_FILENAME_COMPONENT(LIBSNOWPACK_ROOT ${LIBSNOWPACK_ROOT} DIRECTORY) #go up one level
93ENDIF(("${MSVC_TARGET}" STREQUAL "Debug") OR ("${MSVC_TARGET}" STREQUAL "Release"))
94GET_FILENAME_COMPONENT(LIBSNOWPACK_ROOT ${LIBSNOWPACK_ROOT} DIRECTORY) #go up one level
95ELSE(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
96GET_FILENAME_COMPONENT(snowpack_libs_root ${LIBSNOWPACK_LIBRARY} PATH)
97SET(LIBSNOWPACK_ROOT "${snowpack_libs_root}/../")
98STRING(REPLACE " " "\\ " LIBSNOWPACK_ROOT ${LIBSNOWPACK_ROOT})
99ENDIF(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
100
101
102# locate main header file
103FIND_PATH(LIBSNOWPACK_INCLUDE_DIR
104NAMES snowpack/libsnowpack.h
105HINTS
106"${LIBSNOWPACK_ROOT}/include"
107"${LIBSNOWPACK_ROOT}"
108"~/usr/include"
109"/usr/local/include"
110"/usr/include"
111"/opt/include"
112DOC "Location of the libsnowpack headers, like /usr/include"
113)
114ENDIF(LIBSNOWPACK_LIBRARY)
115
116# Set the include dir variables and the libraries and let libfind_process do the rest.
117# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
118SET(LIBSNOWPACK_PROCESS_INCLUDES LIBSNOWPACK_INCLUDE_DIR)
119SET(LIBSNOWPACK_PROCESS_LIBS LIBSNOWPACK_LIBRARY)
120libfind_process(LIBSNOWPACK)

Archive Download this file

Revision: HEAD