MantisBT - CMake
View Issue Details
0012558CMakeCMakepublic2011-11-04 12:062016-06-10 14:31
Gert Wollny 
Kitware Robot 
normalfeaturealways
closedmoved 
CMake 2.8.6 
 
0012558: ADD_LIBRARY should have an option to silence the warning if no source files are given
Sometimes it may be of interest to create a shared library by only linking other libraries without adding additional source files. If one does this, cmake omits a warning. It should be possible to add a flag to the ADD_LIBRARY command that informs cmake that the the user knows what he is doing.

Example use case: in a plug-in framework I want to write tests that check the functionality of the plug-in without having to go through the plug-in loading framework. Therefore, a static library is created that contains the complete plug-in code and the test program links against this static library.
Then, to create the dynamically loadable plug-in I create such a sourceless library that just relinks everything without adding additional code.
create an entry in CMakeLists.txt
ADD_LIBRARY(name MODULE)
or similar.
Attached is a patch against v2.8.6 that does provide a flag NO_SOURCE_FILES that informs cmake that no warning should be emitted.


No tags attached.
patch cmake-2.8.6-nosourcelib.patch (1,271) 2011-11-04 12:06
https://public.kitware.com/Bug/file/4109/cmake-2.8.6-nosourcelib.patch
Issue History
2011-11-04 12:06Gert WollnyNew Issue
2011-11-04 12:06Gert WollnyFile Added: cmake-2.8.6-nosourcelib.patch
2012-03-16 14:23Gert WollnyNote Added: 0028923
2012-08-11 21:35David ColeStatusnew => backlog
2012-08-11 21:35David ColeNote Added: 0030380
2016-06-10 14:28Kitware RobotNote Added: 0041927
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0028923)
Gert Wollny   
2012-03-16 14:23   
Alternatively, one could provide a policy to silence the warning. This would have the advantage that older versions of cmake could still process the CMakeLists.txt file. I don't have a patch for this , because it means touching more code, and I don't want to dig too deep to find out how policies are handled.

The disadvantage of a policy would be that by turning it off, a user might not see the warning when it actually makes sense.
(0030380)
David Cole   
2012-08-11 21:35   
Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0041927)
Kitware Robot   
2016-06-10 14:28   
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.