aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindWSLibrary.cmake
blob: c5c06ece37f4d40d3c9573dfec7735dc968c5abf (plain)
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
#
# - Find WS Library
#  This function is a wrapper for find_library() that does handle vcpkg exported
#  library directory structure

function(FindWSLibrary OUTPUT_LIBRARY)
    cmake_parse_arguments(
        WS_LIB
        ""
        "WIN32_HINTS"
        "NAMES;HINTS;PATHS"
        ${ARGN}
    )

    if (WIN32)
        find_library(${OUTPUT_LIBRARY}_DEBUG
            NAMES ${WS_LIB_NAMES}
            HINTS "${WS_LIB_WIN32_HINTS}/debug/lib"
            PATHS ${WS_LIB_PATHS}
        )
        find_library(${OUTPUT_LIBRARY}_RELEASE
            NAMES ${WS_LIB_NAMES}
            HINTS "${WS_LIB_WIN32_HINTS}/lib"
            PATHS ${WS_LIB_PATHS}
        )

        if (${OUTPUT_LIBRARY}_DEBUG AND ${OUTPUT_LIBRARY}_RELEASE)
            set(${OUTPUT_LIBRARY} debug ${${OUTPUT_LIBRARY}_DEBUG} optimized ${${OUTPUT_LIBRARY}_RELEASE} PARENT_SCOPE)
        endif()
    else()
        find_library(${OUTPUT_LIBRARY}
            NAMES ${WS_LIB_NAMES}
            HINTS ${WS_LIB_HINTS}
            PATHS ${WS_LIB_PATHS}
        )
    endif()
endfunction()