From ee3a769ebf813443c9055f25bd53b0e375420bee Mon Sep 17 00:00:00 2001
From: Rashad Kanavath <rashad.kanavath@c-s.fr>
Date: Mon, 16 Jan 2017 13:12:12 +0100
Subject: [PATCH] COMP: convert path to native (windows path seperator is
 different)

---
 CMake/otbcli.bat.in | 9 +++++++--
 CMakeLists.txt      | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/CMake/otbcli.bat.in b/CMake/otbcli.bat.in
index ffe1fb2a3f..165d833872 100644
--- a/CMake/otbcli.bat.in
+++ b/CMake/otbcli.bat.in
@@ -16,8 +16,13 @@ if exist %CURRENT_SCRIPT_DIR%otbApplicationLauncherCommandLine.exe (
 
 setlocal
 :: works for install tree
-if exist %CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@ (
-  set OTB_APPLICATION_PATH=%CURRENT_SCRIPT_DIR%../@OTB_INSTALL_APP_DIR@;%OTB_APPLICATION_PATH%
+if exist %CURRENT_SCRIPT_DIR%..\@OTB_INSTALL_APP_DIR_NATIVE@ (
+  set OTB_APPLICATION_PATH=%CURRENT_SCRIPT_DIR%..\@OTB_INSTALL_APP_DIR_NATIVE@;%OTB_APPLICATION_PATH%
+)
+
+::set GDAL_DATA, EPSG_CSV and update PATH
+if exist %CURRENT_SCRIPT_DIR%\..\otbenv.cmd (
+    call %CURRENT_SCRIPT_DIR%\..\otbenv.cmd
 )
 
 set LC_NUMERIC=C
diff --git a/CMakeLists.txt b/CMakeLists.txt
index efb8aff8b3..ec57fa8054 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -134,6 +134,9 @@ if(NOT OTB_INSTALL_PACKAGE_DIR)
   set(OTB_INSTALL_PACKAGE_DIR "${OTB_INSTALL_LIBRARY_DIR}/cmake/OTB-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}")
 endif()
 
+#convert path to native for reconfiguring otbcli.bat.in
+file(TO_NATIVE_PATH "${OTB_INSTALL_APP_DIR}" OTB_INSTALL_APP_DIR_NATIVE)
+
 # Override CMake's built-in add_* commands: assign LABELS to tests and targets
 # automatically. Depends on the CMake variable otb-module being set to the
 # "current" module when add_* is called.
-- 
GitLab