Use absolute paths in bat
This commit is contained in:
parent
09fb4c04df
commit
ee6d9f5a3b
|
@ -75,17 +75,27 @@ macro(set_outdir ARCHIVE_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY RUNTIME_OUTPU
|
||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
set(__exe2bat_relative_path false)
|
||||||
|
|
||||||
macro(exe2bat exe_name exe_dir dll_search_paths)
|
macro(exe2bat exe_name exe_dir dll_search_paths)
|
||||||
message(STATUS "Generating ${exe_name}.bat")
|
message(STATUS "Generating ${exe_name}.bat")
|
||||||
set(__exe_name ${exe_name})
|
set(__exe_name ${exe_name})
|
||||||
set(__dll_relative_search_paths "")
|
if(__exe2bat_relative_path)
|
||||||
foreach(path ${dll_search_paths})
|
set(__dll_relative_search_paths "")
|
||||||
file(RELATIVE_PATH __relative_path "${exe_dir}" "${path}")
|
foreach(path ${dll_search_paths})
|
||||||
file(TO_NATIVE_PATH ${__relative_path} __relative_path)
|
file(RELATIVE_PATH __relative_path "${exe_dir}" "${path}")
|
||||||
list(APPEND __dll_relative_search_paths ${__relative_path})
|
file(TO_NATIVE_PATH ${__relative_path} __relative_path)
|
||||||
endforeach()
|
list(APPEND __dll_relative_search_paths ${__relative_path})
|
||||||
#message(STATUS __dll_relative_search_paths: "${__dll_relative_search_paths}")
|
endforeach()
|
||||||
set(__dll_search_paths "${__dll_relative_search_paths}")
|
set(__dll_search_paths "${__dll_relative_search_paths}")
|
||||||
|
else()
|
||||||
|
set(__dll_native_search_paths "")
|
||||||
|
foreach(path ${dll_search_paths})
|
||||||
|
file(TO_NATIVE_PATH ${path} __native_path)
|
||||||
|
list(APPEND __dll_native_search_paths ${__native_path})
|
||||||
|
endforeach()
|
||||||
|
set(__dll_search_paths "${__dll_native_search_paths}")
|
||||||
|
endif()
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CUR_DIR}/templates/exe.bat.in"
|
"${CUR_DIR}/templates/exe.bat.in"
|
||||||
"${exe_dir}/${__exe_name}.bat"
|
"${exe_dir}/${__exe_name}.bat"
|
||||||
|
|
|
@ -7,7 +7,7 @@ if "%MY_PATH_SET_@__exe_name@%"=="" (
|
||||||
set "PATH=@__dll_search_paths@;%PATH%"
|
set "PATH=@__dll_search_paths@;%PATH%"
|
||||||
)
|
)
|
||||||
|
|
||||||
cd "%MY_DIR%"
|
::cd "%MY_DIR%"
|
||||||
"%MY_DIR%@__exe_name@.exe" %*
|
"%MY_DIR%@__exe_name@.exe" %*
|
||||||
cd "%MY_PWD%"
|
::cd "%MY_PWD%"
|
||||||
::pause >nul
|
::pause >nul
|
||||||
|
|
Loading…
Reference in New Issue
Block a user