Warning, /graphics/krita/cmake/kde_macro/KritaToNativePath.cmake is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2021 Dmitry Kazakov <dimula73@gmail.com>
0002 #
0003 # SPDX-License-Identifier: BSD-3-Clause
0004 #
0005 
0006 # krita_to_native_path(<path_list> <output_var>)
0007 #
0008 # Converts path separators of the list <path_list> into the native format
0009 # and stores the result in <output_var>
0010 #
0011 # Usage:
0012 #
0013 # krita_to_native_path("${KRITA_PYTHONPATH}" _krita_pythonpath)
0014 
0015 function (krita_to_native_path path_list output_var)
0016     if(WIN32)
0017         if(${CMAKE_VERSION} VERSION_LESS "3.20.0")
0018             foreach (_path ${path_list})
0019                 string(REPLACE "//" "/" _path "${_path}")
0020                 string(REPLACE "/" "\\" _path "${_path}")
0021                 list(APPEND _output_var "${_path}")
0022             endforeach()
0023 
0024             set (${output_var} ${_output_var} PARENT_SCOPE)
0025         else()
0026             cmake_path(CONVERT "${path_list}" TO_NATIVE_PATH_LIST _output_var NORMALIZE)
0027             set (${output_var} ${_output_var} PARENT_SCOPE)
0028         endif()
0029     else()
0030         set (${output_var} ${path_list} PARENT_SCOPE)
0031     endif()
0032 endfunction()
0033 
0034 
0035 # krita_to_native_environment_path_list(<path_list> <output_var>)
0036 #
0037 # Converts the list of paths in <path_list> into the native format
0038 # and then joins them into a string suitable to be assigned to
0039 # PATH (or PATH-like) variable. On Windows the string is joined
0040 # using ';' separator. On other platforms with ':' separator.
0041 #
0042 # To avoid conversion back to a list object, the function adds
0043 # separators in a form of generators: $<SEMICOLON> or $<COLON>
0044 #
0045 # Usage:
0046 #
0047 # krita_to_native_environment_path_list("${KRITA_PYTHONPATH}" _krita_pythonpath)
0048 
0049 
0050 function (krita_to_native_environment_path_list path_list output_var)
0051     krita_to_native_path("${path_list}" _output_var)
0052 
0053 if(WIN32)
0054     list(JOIN _output_var $<SEMICOLON> _output_var)
0055 else()
0056     list(JOIN _output_var $<COLON> _output_var)
0057 endif()
0058 
0059     set (${output_var} ${_output_var} PARENT_SCOPE)
0060 endfunction()