Merge branch 'main/rendor-staging' into fixes
[ryzomcore.git] / CMakeModules / FindSteam.cmake
blob8d9b12372a8b1d7c0ecbdda16e893a28e33e4abc
1 # - Locate Steam API
2 # This module defines
3 #  STEAM_LIBRARY, the library to link against
4 #  STEAM_FOUND, if false, do not try to link to STEAM
5 #  STEAM_INCLUDE_DIR, where to find headers.
7 IF(STEAM_LIBRARY AND STEAM_INCLUDE_DIR)
8   # in cache already
9   SET(Steam_FIND_QUIETLY TRUE)
10 ENDIF()
13 FIND_PATH(STEAM_INCLUDE_DIR
14   steam_api.h
15   PATH_SUFFIXES steam
16   PATHS
17   $ENV{STEAM_DIR}/public
20 IF(WIN32)
21   IF(TARGET_X64)
22     SET(STEAM_LIBNAME steam_api64)
23     SET(STEAM_RUNTIMENAME steam_api64.dll)
24     SET(STEAM_PATHNAME redistributable_bin/win64)
25   ELSE()
26     SET(STEAM_LIBNAME steam_api)
27     SET(STEAM_RUNTIMENAME steam_api.dll)
28     SET(STEAM_PATHNAME redistributable_bin)
29   ENDIF()
30 ELSEIF(APPLE)
31   # universal binary
32   SET(STEAM_LIBNAME steam_api)
33   SET(STEAM_RUNTIMENAME libsteam_api.dylib)
34   SET(STEAM_PATHNAME redistributable_bin/osx32)
35 ELSE()
36   SET(STEAM_LIBNAME steam_api)
37   SET(STEAM_RUNTIMENAME libsteam_api.so)
38   IF(TARGET_X64)
39     SET(STEAM_PATHNAME redistributable_bin/linux64)
40   ELSE()
41     SET(STEAM_PATHNAME redistributable_bin/linux32)
42   ENDIF()
43 ENDIF()
45 FIND_LIBRARY(STEAM_LIBRARY
46   NAMES ${STEAM_LIBNAME}
47   HINTS
48   $ENV{STEAM_DIR}/${STEAM_PATHNAME}
51 FIND_FILE(STEAM_RUNTIME
52   NAMES ${STEAM_RUNTIMENAME}
53   HINTS
54   $ENV{STEAM_DIR}/${STEAM_PATHNAME}
55   PATHS
56   ${EXTERNAL_BINARY_PATH}
57   ${CMAKE_LIBRARY_PATH}
58   /usr/local/lib
59   /usr/lib
62 # Don't need to check STEAM_LIBRARY because we're dynamically loading Steam DLL
63 IF(STEAM_INCLUDE_DIR)
64   SET(STEAM_FOUND ON)
65   SET(STEAM_LIBRARIES ${STEAM_LIBRARY})
66   SET(STEAM_INCLUDE_DIRS ${STEAM_INCLUDE_DIR})
67   IF(NOT Steam_FIND_QUIETLY)
68     MESSAGE(STATUS "Found Steam: ${STEAM_INCLUDE_DIR} and ${STEAM_RUNTIME}")
69   ENDIF()
70 ELSE()
71   IF(NOT Steam_FIND_QUIETLY)
72     MESSAGE(STATUS "Warning: Unable to find Steam!")
73   ENDIF()
74 ENDIF()