Mercurial > minori
comparison dep/fmt/support/cmake/JoinPaths.cmake @ 343:1faa72660932
*: transfer back to cmake from autotools
autotools just made lots of things more complicated than
they should have and many things broke (i.e. translations)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Thu, 20 Jun 2024 05:56:06 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
342:adb79bdde329 | 343:1faa72660932 |
---|---|
1 # This module provides function for joining paths | |
2 # known from from most languages | |
3 # | |
4 # Original license: | |
5 # SPDX-License-Identifier: (MIT OR CC0-1.0) | |
6 # Explicit permission given to distribute this module under | |
7 # the terms of the project as described in /LICENSE.rst. | |
8 # Copyright 2020 Jan Tojnar | |
9 # https://github.com/jtojnar/cmake-snips | |
10 # | |
11 # Modelled after Python’s os.path.join | |
12 # https://docs.python.org/3.7/library/os.path.html#os.path.join | |
13 # Windows not supported | |
14 function(join_paths joined_path first_path_segment) | |
15 set(temp_path "${first_path_segment}") | |
16 foreach(current_segment IN LISTS ARGN) | |
17 if(NOT ("${current_segment}" STREQUAL "")) | |
18 if(IS_ABSOLUTE "${current_segment}") | |
19 set(temp_path "${current_segment}") | |
20 else() | |
21 set(temp_path "${temp_path}/${current_segment}") | |
22 endif() | |
23 endif() | |
24 endforeach() | |
25 set(${joined_path} "${temp_path}" PARENT_SCOPE) | |
26 endfunction() |