File: FixWindowsPath.cmake

package info (click to toggle)
ispc 1.28.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 97,620 kB
  • sloc: cpp: 77,067; python: 8,303; yacc: 3,337; lex: 1,126; ansic: 631; sh: 475; makefile: 17
file content (30 lines) | stat: -rw-r--r-- 1,001 bytes parent folder | download | duplicates (2)
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
#
#  Copyright (c) 2018-2023, Intel Corporation
#
#  SPDX-License-Identifier: BSD-3-Clause

#
# ispc FixWindowsPath.cmake
#
if (WIN32)
    find_program(CYGPATH_EXECUTABLE cygpath
        PATHS ${CYGWIN_INSTALL_PATH}/bin)
        if (NOT CYGPATH_EXECUTABLE)
            message(WARNING "Failed to find cygpath" )
        endif()
    # To avoid cygwin warnings about dos-style path during VS build
    function (win_path_to_cygwin inPath execPath outPath)
        set(cygwinPath ${inPath})
        # Need to update path only if tool was installed as cygwin package
        if (${execPath} MATCHES ".*cygwin.*")
            if (${CMAKE_GENERATOR} MATCHES "Visual Studio*")
                execute_process(
                    COMMAND ${CYGPATH_EXECUTABLE} -u ${inPath}
                    OUTPUT_VARIABLE cygwinPath
                )
                string(STRIP "${cygwinPath}" cygwinPath)
            endif()
        endif()
        set(${outPath} ${cygwinPath} PARENT_SCOPE)
    endfunction()
endif()