github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/pybind11/tools/JoinPaths.cmake (about) 1 # This module provides function for joining paths 2 # known from most languages 3 # 4 # SPDX-License-Identifier: (MIT OR CC0-1.0) 5 # Copyright 2020 Jan Tojnar 6 # https://github.com/jtojnar/cmake-snips 7 # 8 # Modelled after Python’s os.path.join 9 # https://docs.python.org/3.7/library/os.path.html#os.path.join 10 # Windows not supported 11 function(join_paths joined_path first_path_segment) 12 set(temp_path "${first_path_segment}") 13 foreach(current_segment IN LISTS ARGN) 14 if(NOT ("${current_segment}" STREQUAL "")) 15 if(IS_ABSOLUTE "${current_segment}") 16 set(temp_path "${current_segment}") 17 else() 18 set(temp_path "${temp_path}/${current_segment}") 19 endif() 20 endif() 21 endforeach() 22 set(${joined_path} "${temp_path}" PARENT_SCOPE) 23 endfunction()