MantisBT - CMake
View Issue Details
0016050CMakeCMakepublic2016-04-06 03:412016-06-10 14:31
Lluís Batlle 
Kitware Robot 
normalmajoralways
closedmoved 
i686Windows7
CMake 3.5.1 
 
0016050: Missing source files generate broken Makefiles (NMake)
Using the "NMake Makefiles" and "NMake Makefiles JOM" generate broken makefiles, in case that one source file of ADD_EXECUTABLE is missing.

In my case, I have something like:

ADD_EXECUTABLE(program WIN32 src1.cpp src1.hpp help.h)
TARGET_LINK_LIBRARIES(program lib1 lib2)

Running "cmake -G 'NMake Makefiles'" (or JOM) it reports properly:
CMake Error at CMakeLists.txt:57 (ADD_EXECUTABLE):
  Cannot find source file:

    F:/projects/prog/build/help.h

But then I can type "nmake program", and it goes on building lib1 and lib2, and then it tries to link program with the libs without any object files. It does not compile any "program" source files. Of course the linker reports missing _WinMainCRTStartup.

If I use the ninja generator, it works fine. When trying to run "ninja program", it tries to run cmake again, and it fails because of the missing source file.

NMake should also do the same: run cmake again, to see if the CMakeLists.txt has been fixed and all sources are found.

I had missed the "CMake Error" line when using NMake, and I spent time trying to find out the sudden miss of the _WinMainCRTStartup symbol.
No tags attached.
Issue History
2016-04-06 03:41Lluís BatlleNew Issue
2016-06-10 14:29Kitware RobotNote Added: 0042976
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
(0042976)
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.