Hi All, Windows 10 anniversary edition comes with support to execute Linux binaries. I have been trying to use it with one of our projects, but I have been getting a weird error. Maybe someone can help me?
The target is pretty simple: set(BASH "C:\\Windows\\System32\\bash.exe") set(ARGS "--help") add_custom_target(linux ${BASH} ${ARGS}) If I then build that project in visual studio (with some extra verbosity) I get: Target "CustomBuild" in file "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets" from project "C:\_Working\delegate\build\linux.vcxproj" (target "_BuildGenerateSourcesAction" depends on it): Using "CustomBuild" task from assembly "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Build.CppTasks.Common.dll". Task "CustomBuild" Write Tracking Logs: x64\Debug\linux\linux.tlog\custombuild.write.1.tlog Read Tracking Logs: x64\Debug\linux\linux.tlog\custombuild.read.1.tlog No output for C:\_WORKING\DELEGATE\BUILD\CMAKEFILES\3FA5525E877A7559336C7D412E1B43B0\LINUX.RULE|C:\_WORKING\DELEGATE\CMAKELISTS.TXT was found in the tracking log; source compilation required. C:\_Working\delegate\CMakeLists.txt will be compiled as it was not found in the tracking log. C:\_Working\delegate\build\CMakeFiles\3fa5525e877a7559336c7d412e1b43b0\linux.rule will be compiled as it was not found in the tracking log. setlocal "C:\Program Files (x86)\CMake\bin\cmake.exe" -HC:/_Working/delegate -BC:/_Working/delegate/build --check-stamp-file C:\_Working\delegate\build\CMakeFiles\generate.stamp if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd setlocal C:\Windows\System32\bash.exe --help if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd Building Custom Rule C:/_Working/delegate/CMakeLists.txt CMake does not need to re-run because C:\_Working\delegate\build\CMakeFiles\generate.stamp is up-to-date. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code -1073740791. Done executing task "CustomBuild" -- FAILED. Done building target "CustomBuild" in project "linux.vcxproj" -- FAILED. The command line seems correct. If I just copy it to the windows prompt it works fine: C:\Users\tmc> C:\Windows\System32\bash.exe --help GNU bash, version 4.3.11(1)-release-(x86_64-pc-linux-gnu) Usage: /bin/bash [GNU long option] [option] ... /bin/bash [GNU long option] [option] script-file ... GNU long options: --debug --debugger --dump-po-strings --dump-strings --help --init-file --login --noediting --noprofile --norc --posix --rcfile --restricted --verbose --version Shell options: -ilrsD or -c command or -O shopt_option (invocation only) -abefhkmnptuvxBCHP or -o option Type `/bin/bash -c "help set"' for more information about shell options. Type `/bin/bash -c help' for more information about shell builtin commands. Use the `bashbug' command to report bugs. I also tried to use it from the visual studio "external tools" and it seems to work. So I am not sure what is going on. Is there a way to debug custom_targets? In case anyone tries the example above on a 64 bit machine: You will need to copy bash.exe from system32 to syswow64 since VS is 32 bits. Tiago
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake