summaryrefslogtreecommitdiffstats
path: root/cmake/FindMilesSDK.cmake
blob: 57da3a6e8495a8fa1c1400b0989ea32f451567b5 (plain) (blame)
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
# - Find Miles SDK
# Find the Miles SDK header + import library
#
#  MilesSDK_INCLUDE_DIR - Where to find mss.h
#  MilesSDK_LIBRARIES   - List of libraries when using MilesSDK.
#  MilesSDK_FOUND       - True if Miles SDK found.
#  MilesSDK::MilesSDK   - Imported library of Miles SDK

find_path(MilesSDK_INCLUDE_DIR mss.h
    PATHS "${MilesSDK_DIR}"
    PATH_SUFFIXES include
)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
    set(_miles_sdk_libname mss64)
else()
    set(_miles_sdk_libname mss32)
endif()

find_library(MilesSDK_LIBRARIES NAMES ${_miles_sdk_libname}
    PATHS "${MilesSDK_DIR}"
    PATH_SUFFIXES lib
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MilesSDK DEFAULT_MSG MilesSDK_LIBRARIES MilesSDK_INCLUDE_DIR)

if(NOT TARGET MilesSDK::MilesSDK)
    add_library(MilesSDK::MilesSDK UNKNOWN IMPORTED)
    set_target_properties(MilesSDK::MilesSDK PROPERTIES
        IMPORTED_LOCATION "${MilesSDK_LIBRARIES}
        INTERFACE_INCLUDE_DIRECTORIES "${MilesSDK_INCLUDE_DIR}"
    )
endif()