summaryrefslogtreecommitdiffhomepage
path: root/cmake/opentrack-load-user-settings.cmake
blob: e84384d3e8f46dd7cde7576c983e7ac5f0bd167c (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
include_guard(GLOBAL)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
    set(__sdk_username "$ENV{USERNAME}")
else()
    set(__sdk_username "$ENV{USER}")
endif()

if(".${__sdk_username}" STREQUAL ".")
    set(__sdk_username "(I-have-no-name)")
endif()

if(WIN32)
    set(__sdk_target_os "windows")
else()
    string(REGEX MATCH "^Linux (.+)-Microsoft\$" __sdk_target_os_match "${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}")
    if(__sdk_target_os_match)
        set(__sdk_target_os "Windows-WSL")
    else()
        set(__sdk_target_os "${CMAKE_SYSTEM_NAME}")
    endif()
endif()

if(NOT CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
    set(__sdk_host_os "${CMAKE_HOST_SYSTEM_NAME}-cross-")
else()
    set(__sdk_host_os "")
endif()

set(__sdk_paths_filename "${CMAKE_CURRENT_SOURCE_DIR}/${__sdk_paths_basename}")

if(EXISTS "${__sdk_paths_filename}")
    message(STATUS "Loading user settings '${__sdk_paths_basename}'")
    include("${__sdk_paths_filename}")
else()
    message(STATUS "User settings file '${__sdk_paths_basename}' doesn't exist")
endif()