Closed myd7349 closed 5 years ago
You should quote those, or there will be problems when those paths contain spaces.
Hi! @spinda Thanks! In fact, I quoted them at first, but unquoted them just before I created this PR since it seems CMake can handle it correctly.
On Ubuntu, the generated makefile has thses lines in it:
hydrogen-run-tests.done: hydrogen-tests
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold --progress-dir=/home/myd/libhydrogen/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Generating hydrogen-run-tests.done"
"/home/myd/cmake 3.14.0 linux/cmake-3.14.0-Linux-x86_64/bin/cmake" -E remove /home/myd/libhydrogen/build/hydrogen-run-tests.done
"/home/myd/cmake 3.14.0 linux/cmake-3.14.0-Linux-x86_64/bin/ctest" -C --output-on-failure
"/home/myd/cmake 3.14.0 linux/cmake-3.14.0-Linux-x86_64/bin/cmake" -E touch /home/myd/libhydrogen/build/hydrogen-run-tests.done
On Win10, I got this in hydrogen-run-tests.vcxproj
:
<Command Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">setlocal
cd C:\Users\vcpkg\Desktop\libhydrogen\build2
if %errorlevel% neq 0 goto :cmEnd
C:
if %errorlevel% neq 0 goto :cmEnd
"E:\Program Files\CMake\bin\cmake.exe" -E remove C:/Users/vcpkg/Desktop/libhydrogen/build2/hydrogen-run-tests.done
if %errorlevel% neq 0 goto :cmEnd
"E:\Program Files\CMake\bin\ctest.exe" -C RelWithDebInfo --output-on-failure
if %errorlevel% neq 0 goto :cmEnd
"E:\Program Files\CMake\bin\cmake.exe" -E touch C:/Users/vcpkg/Desktop/libhydrogen/build2/hydrogen-run-tests.done
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd</Command>
I read this post https://stackoverflow.com/questions/35847655/when-should-i-quote-variables, it also recommands to quote those file paths in add_custom_command
. So I will create a new PR.
Thanks again!
When I was trying to add
libhydrogen
intovcpkg
(https://github.com/microsoft/vcpkg/pull/7436), thevcpkg
's CI system reports it fails on Linux and macOS: https://dev.azure.com/vcpkg/public/_build/results?buildId=8415 https://dev.azure.com/vcpkg/public/_build/results?buildId=8418 I downloaded the port failure logs and got this:It complains that
/bin/sh: 1: cmake: not found
. I am not sure how is CMake installed onvcpkg
's CI agents, it just does not work.This patch uses CMake's predefined ${CMAKE_COMMAND} and ${CMAKE_CTEST_COMMAND} variables, and it works fine.