[cmake-developers] [CMake 0014494]: Doesn't create .lib for header only targets on Windows.

Mantis Bug Tracker mantis at public.kitware.com
Sun Oct 20 03:27:47 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14494 
====================================================================== 
Reported By:                icando
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14494
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   high
Status:                     new
====================================================================== 
Date Submitted:             2013-10-20 03:27 EDT
Last Modified:              2013-10-20 03:27 EDT
====================================================================== 
Summary:                    Doesn't create .lib for header only targets on
Windows.
Description: 
Not sure if it should be a bug report or a feature request.  Basically the
support for header-only library on Windows is missing.

I've tested under Linux and the feature IS actually supported.  A header-only
library will generate minimum .a file that has nothing in it.  However, on
Windows, it passes no source file to the 'lib' tool and the tool doesn't
generate any files in this case.

It would be better to handle it in CMake side as opposed to the CMakeLists.txt
side.

The simplest fix would be generating an empty source file for windows platform
if it is header only.  A more complicated fix is when CMake generates Makefile,
it doesn't generate dependencies on the .a or .lib if it is header-only target,
but generates dependencies on child targets.

Steps to Reproduce: 
Unzip the attached file, and under Windows, run 
cmake -G "NMake Makefiles"
nmake

It will produce:
NMAKE : fatal error U1073: don't know how to make 'B.lib'
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-10-20 03:27 icando         New Issue                                    
2013-10-20 03:27 icando         File Added: tests.zip                        
======================================================================




More information about the cmake-developers mailing list