View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015847CMakeCMakepublic2015-11-16 16:282016-06-10 14:31
ReporterErik Sjölund 
Assigned ToKitware Robot 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
Platformx86_64OSUbuntuOS Version15.10
Product VersionCMake 3.4 
Target VersionFixed in Version 
Summary0015847: ADD_LIBRARY without any sources generates an unnecessary warning
DescriptionI think this warning could be removed:
"You have called ADD_LIBRARY for library foobar without any source files. This typically indicates a problem with your CMakeLists.txt file"

The reason is that I would like to add the target sources at a later time with the target_sources command.

For more explanation see my post:
https://cmake.org/pipermail/cmake-developers/2015-July/025761.html [^]

and the answer from Brad King:
https://cmake.org/pipermail/cmake-developers/2015-July/025764.html [^]
Steps To ReproduceSee the attached file: bug.txt
TagsNo tags attached.
Attached Filestxt file icon bug.txt [^] (818 bytes) 2015-11-16 16:28 [Show Content]

 Relationships

  Notes
(0039944)
Bartosz (reporter)
2015-12-03 04:26

The warning could be easily deleted from file:
  ./Source/cmAddLibraryCommand.cxx

What kind of diagnostic (if at generate time no SOURCES are available) should be added?
(0039947)
Brad King (manager)
2015-12-03 08:23

> What kind of diagnostic (if at generate time no SOURCES are available) should be added?

There is already a diagnostic in that case:

 CMake Error: Cannot determine link language for target "...".

since the warning in question does not prevent generation from being attempted.

If we remove the warning then the error message should be updated to mention that there are no source files (if indeed there are no sources).
(0042888)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2015-11-16 16:28 Erik Sjölund New Issue
2015-11-16 16:28 Erik Sjölund File Added: bug.txt
2015-12-03 04:26 Bartosz Note Added: 0039944
2015-12-03 08:23 Brad King Note Added: 0039947
2016-06-10 14:29 Kitware Robot Note Added: 0042888
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team