View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012471CMakeCMakepublic2011-09-21 09:092012-02-06 06:07
ReporterHauke Heibel 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionno change required 
PlatformWindows 7 Prof.OSOS Version
Product VersionCMake 2.8.5 
Target VersionFixed in Version 
Summary0012471: CMake add_custom_command problem when triggering a FATAL_ERROR in MSVC
DescriptionIf have multiple custom commands which call

  message(FATAL_ERROR "Some message")

in case of errors. If you do this and encounter such a case MSVC generates many MSB3073 errors. I think this issue is somewhat related to http://public.kitware.com/Bug/view.php?id=11938. [^]

The problem is that the MSVC's error message hides the one generated by CMake. It were nice, if CMake could terminate the script without issuing multiple MSB3073 errors.
Steps To ReproduceCreate any custom command via

add_custom_command(TARGET FooCommand
  COMMAND ${CMAKE_COMMAND}
  -P BarScript.cmake
)

and call

message(FATAL_ERROR "Some message")

from within the BarScript.cmake
TagsNo tags attached.
Attached Filestxt file icon msvc_error_output.txt [^] (3,242 bytes) 2011-09-21 09:09 [Show Content]
zip file icon issue_12471.zip [^] (989 bytes) 2011-09-22 02:42

 Relationships

  Notes
(0027466)
Brad King (manager)
2011-09-21 16:39

I cannot reproduce this. Please attach a source tarball/zip with a minimal example that reproduces this in a small source tree.

What CMake generator are you using?
(0027467)
Hauke Heibel (reporter)
2011-09-22 02:46

I've added an example which I should have done it right away.

CMake version: 2.8.5
Generator: Visual Studio 10 Win64
Visual Studio: Version 10.0.40219.1 SP1Rel

HTH,
Hauke
(0027469)
Brad King (manager)
2011-09-22 08:12

I get this output:

2>------ Build started: Project: CopySatelliteDLLs, Configuration: Debug x64 ------
2>Build started 9/22/2011 8:05:11 AM.
2>InitializeBuildStatus:
2> Creating "x64\Debug\CopySatelliteDLLs\CopySatelliteDLLs.unsuccessfulbuild" because "AlwaysCreate" was specified.
2>CustomBuild:
2> Copying satellite DLLs.
2> Building Custom Rule C:/.../issue_12471/CMakeLists.txt
2> CMake does not need to re-run because C:\...\issue_12471\b-vs10-64\CMakeFiles\generate.stamp is up-to-date.
2>PostBuildEvent:
2> CMake Error at C:/.../issue_12471/CopySatelliteDLLs.cmake:1 (message):
2> Triggering MSVC error.
2>
2>
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "setlocal
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -P "C:/.../issue_12471/CopySatelliteDLLs.cmake"
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmEnd
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmErrorLevel
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: exit /b %1
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmDone
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 1.
2>
2>Build FAILED.
2>
2>Time Elapsed 00:00:00.24

It shows the error from the script and then reports the command that failed. What is wrong?
(0027470)
Brad King (manager)
2011-09-22 08:17

Even if I manually strip the post-build event down to _just_ the cmake -P invocation, I still get this:

2>------ Build started: Project: CopySatelliteDLLs, Configuration: Debug x64 ------
2>Build started 9/22/2011 8:15:41 AM.
2>InitializeBuildStatus:
2> Creating "x64\Debug\CopySatelliteDLLs\CopySatelliteDLLs.unsuccessfulbuild" because "AlwaysCreate" was specified.
2>CustomBuild:
2> Copying satellite DLLs.
2>PostBuildEvent:
2> CMake Error at C:/.../issue_12471/CopySatelliteDLLs.cmake:1 (message):
2> Triggering MSVC error.
2>
2>
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command ""C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -P "C:/.../issue_12471/CopySatelliteDLLs.cmake"
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073:
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 1.
2>
2>Build FAILED.
2>
2>Time Elapsed 00:00:00.12

It is VS that reports the MSB3073 errors, not CMake.
(0027471)
Hauke Heibel (reporter)
2011-09-22 08:27

Ok, thanks for investigating this.

The more add_custom_command's I am adding to the same target the more errors I am seeing - basically 8 additional messages per DLL I am copying.

I was just hoping there was a way to suppress them on CMake's side.

- Hauke
(0028512)
David Cole (manager)
2012-02-06 06:07

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

 Issue History
Date Modified Username Field Change
2011-09-21 09:09 Hauke Heibel New Issue
2011-09-21 09:09 Hauke Heibel File Added: msvc_error_output.txt
2011-09-21 16:39 Brad King Note Added: 0027466
2011-09-22 02:42 Hauke Heibel File Added: issue_12471.zip
2011-09-22 02:46 Hauke Heibel Note Added: 0027467
2011-09-22 08:12 Brad King Note Added: 0027469
2011-09-22 08:17 Brad King Note Added: 0027470
2011-09-22 08:27 Hauke Heibel Note Added: 0027471
2011-09-22 08:30 Brad King Status new => resolved
2011-09-22 08:30 Brad King Resolution open => no change required
2011-09-22 08:30 Brad King Assigned To => Brad King
2012-02-06 06:07 David Cole Note Added: 0028512
2012-02-06 06:07 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team