Files
Cockatrice/cmake/expanduser.cmake
2023-01-11 18:58:02 -05:00

20 lines
329 B
CMake

# expands ~ to user home directory
#
# usage:
# expanduser("~/code" x)
function(expanduser in outvar)
if(CMAKE_VERSION VERSION_LESS 3.21)
get_filename_component(out ${in} ABSOLUTE)
else()
file(REAL_PATH ${in} out EXPAND_TILDE)
endif()
set(${outvar}
${out}
PARENT_SCOPE
)
endfunction(expanduser)