View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015808CMakeCMakepublic2015-10-25 22:242016-03-07 09:12
Reporterovz 
Assigned To 
PriorityhighSeverityblockReproducibilityalways
StatusclosedResolutionno change required 
PlatformWindows 8.1OSOS Version
Product Version 
Target VersionFixed in Version 
Summary0015808: POST_BUILD command for "Visual Studio 14 2015" generates superfluous "C:"
DescriptionIf I specify WORKING_DIRECTORY in add_custom_command(... POST_BUILD ..) the following snippet is generated in Post-Build event code. Note that extra command specifying just "C:" after expected cd command.

setlocal
cd C:\__temp\src\cmake\post_build_work_dir\build\working_dir
if %errorlevel% neq 0 goto :cmEnd
C:
if %errorlevel% neq 0 goto :cmEnd


Steps To Reproduce* Unpack post_build_work_dir.zip in attachment.

* You can inspect contents of the build directory. These are CMake generated files I get on my machine.

* Clean up build directory

* Run commands

cd build
cmake -G "Visual Studio 14 2015" ..

* Open build/post_build_work_dir.sln

* In Visual Studio right-click on post_build_work_dir project. Select Properties

* Navigate to Configuration Properties > Build Events > Post-Build Event

* Note the extra "C:" command in the post-build event text



Additional InformationHere is full text of Post-Build event generated after following steps of reproduction

setlocal
cd C:\__temp\src\cmake\post_build_work_dir\build\working_dir
if %errorlevel% neq 0 goto :cmEnd
C:
if %errorlevel% neq 0 goto :cmEnd
some_command
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
TagsNo tags attached.
Attached Fileszip file icon post_build_work_dir.zip [^] (106,879 bytes) 2015-10-25 22:24

 Relationships

  Notes
(0039674)
ovz (reporter)
2015-10-25 22:26

Reproduced with both CMake 3.3.2 and CMake 3.4.0-rc2
(0039675)
Brad King (manager)
2015-10-26 08:41

The "C:" command ensures that the current working drive is correct. The "cd c:\..." command only changes the working directory for the given drive.
(0039678)
ovz (reporter)
2015-10-26 11:24

Makes sense. Haven't worked with multiple drives for some time already.

We can close this issue.
(0039685)
Gregor Jasny (developer)
2015-10-27 15:02

You could use /d switch for cd command to also change drive: http://ss64.com/nt/cd.html [^]
(0039686)
Brad King (manager)
2015-10-27 15:08

Re 0015808:0039685: That's not portable to older cmd versions.
(0040627)
Robert Maynard (manager)
2016-03-07 09:12

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2015-10-25 22:24 ovz New Issue
2015-10-25 22:24 ovz File Added: post_build_work_dir.zip
2015-10-25 22:26 ovz Note Added: 0039674
2015-10-26 08:41 Brad King Note Added: 0039675
2015-10-26 11:24 ovz Note Added: 0039678
2015-10-26 12:03 Brad King Status new => resolved
2015-10-26 12:03 Brad King Resolution open => no change required
2015-10-27 15:02 Gregor Jasny Note Added: 0039685
2015-10-27 15:08 Brad King Note Added: 0039686
2016-03-07 09:12 Robert Maynard Note Added: 0040627
2016-03-07 09:12 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team