[CMake] Ninja generator bug when handling Windows .dll without associated import .lib

Brad King brad.king at kitware.com
Mon Aug 1 15:26:23 EDT 2016


On 07/21/2016 12:27 PM, Kamen Lilov wrote:
> When a Windows .DLL is generated, the Microsoft linker may sometimes
> decide that no import library needs to be built. This happens often in
> one of our projects, we have many .dll’s that tie themselves into our
> infrastructure during static class initialization and export no
> functions (although they do work and get called via class method
> pointers from elsewhere)
> 
> The Ninja CMake generator seems to always emit a dependency on an
> associated import library along with the .dll file.

That output needs to be listed or it will not be re-built when missing.

The way to tell CMake to build a .dll with no .lib is to specify the
add_library command's MODULE library type.  This specifies that it is
a loaded module and not something that is linked.

-Brad



More information about the CMake mailing list