MantisBT - CMake
View Issue Details
0015847CMakeCMakepublic2015-11-16 16:282016-06-10 14:31
Erik Sjölund 
Kitware Robot 
normalminoralways
closedmoved 
x86_64Ubuntu15.10
CMake 3.4 
 
0015847: ADD_LIBRARY without any sources generates an unnecessary warning
I 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 [^]
See the attached file: bug.txt
No tags attached.
txt bug.txt (818) 2015-11-16 16:28
https://public.kitware.com/Bug/file/5576/bug.txt
Issue History
2015-11-16 16:28Erik SjölundNew Issue
2015-11-16 16:28Erik SjölundFile Added: bug.txt
2015-12-03 04:26BartoszNote Added: 0039944
2015-12-03 08:23Brad KingNote Added: 0039947
2016-06-10 14:29Kitware RobotNote Added: 0042888
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0039944)
Bartosz   
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   
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   
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.