Commit c5a86194 authored by Alexander Alekhin's avatar Alexander Alekhin

cmake: fix install path

CMake doesn't work with empty paths ("") or paths which contains "./"
parent 02edfc8d
...@@ -84,14 +84,10 @@ macro(ocv_check_environment_variables) ...@@ -84,14 +84,10 @@ macro(ocv_check_environment_variables)
endforeach() endforeach()
endmacro() endmacro()
macro(ocv_path_join result_var P1 P2) macro(ocv_path_join result_var P1 P2_)
string(REGEX REPLACE "^[/]+" "" P2 "${P2}") string(REGEX REPLACE "^[/]+" "" P2 "${P2_}")
if("${P1}" STREQUAL "") if("${P1}" STREQUAL "" OR "${P1}" STREQUAL ".")
if("${P2}" STREQUAL "") set(${result_var} "${P2}")
set(${result_var} ".")
else()
set(${result_var} "${P2}")
endif()
elseif("${P1}" STREQUAL "/") elseif("${P1}" STREQUAL "/")
set(${result_var} "/${P2}") set(${result_var} "/${P2}")
elseif("${P2}" STREQUAL "") elseif("${P2}" STREQUAL "")
...@@ -99,6 +95,11 @@ macro(ocv_path_join result_var P1 P2) ...@@ -99,6 +95,11 @@ macro(ocv_path_join result_var P1 P2)
else() else()
set(${result_var} "${P1}/${P2}") set(${result_var} "${P1}/${P2}")
endif() endif()
string(REGEX REPLACE "([/\\]?)[\\.][/\\]" "\\1" ${result_var} "${${result_var}}")
if("${${result_var}}" STREQUAL "")
set(${result_var} ".")
endif()
#message(STATUS "'${P1}' '${P2_}' => '${${result_var}}'")
endmacro() endmacro()
# rename modules target to world if needed # rename modules target to world if needed
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment