View Issue Details [ Jump to Notes ] | [ Print ] |
ID | Project | Category | View Status | Date Submitted | Last Update |
0014765 | CMake | CMake | public | 2014-02-19 15:15 | 2014-10-06 10:32 |
|
Reporter | Alexander Richardson | |
Assigned To | | |
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | duplicate | |
Platform | | OS | | OS Version | |
Product Version | CMake 2.8.12.2 | |
Target Version | | Fixed in Version | | |
|
Summary | 0014765: file(RELATIVE_PATH) does not handle /../ and /./ properly |
Description | It seems file(RELATIVE_PATH adds a .. element for every slash in the file name even if it is a /./ or /../ directory name. |
Steps To Reproduce | Run the attached testcase |
Tags | No tags attached. |
|
Attached Files | CMakeLists.txt [^] (677 bytes) 2014-02-19 15:15 [Show Content] [Hide Content]cmake_minimum_required(VERSION 2.8.12)
project(relative_path_test)
function(check_relative_path _src _dest _expected)
file(RELATIVE_PATH _rel_path "${_src}" "${_dest}")
if ("${_rel_path}" STREQUAL "${_expected}")
message(STATUS "Test passed: relative path from ${_src} to ${_dst} is ${_rel_path}")
else()
message(WARNING "Test failed: relative path from ${_src} to ${_dst} returned ${_rel_path}, should be ${_expected}")
endif()
endfunction()
check_relative_path("/usr/share" "/bin/bash" "../../bin/bash")
check_relative_path("/usr/./share/" "/bin/bash" "../../bin/bash")
check_relative_path("/usr/share/../bin/" "/bin/bash" "../../bin/bash")
|
|