[cmake-developers] [CMake 0015754]: Visual Studio incremental build not working properly when target names start with a capital letter

Mantis Bug Tracker mantis at public.kitware.com
Mon Sep 21 10:54:30 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15754 
====================================================================== 
Reported By:                Johannes Asal
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15754
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-09-21 10:54 EDT
Last Modified:              2015-09-21 10:54 EDT
====================================================================== 
Summary:                    Visual Studio incremental build not working properly
when target names start with a capital letter
Description: 
When using a target name starting with a capital letter (e.g. Mylibrary) in
add_library (and probably also add_executable), GCC toolchains build fine but
Visual Studio (tested with 2010 specifically) refuses to compile new .cpp files
in the first incremental build after adding them to the CMakeLists.txt. However,
it correctly detects that the CMakeLists.txt has changed and reconfigures
accordingly. The second incremental build compiles the added files, which makes
it even more strange. Please note that the bug occurs only when building via the
CMake command line interface (cmake.exe --build). Building from within Visual
Studio works always which is why I think it must be a problem with CMake.

Steps to Reproduce: 
Install Visual Studio 2010. Unzip the attached ZIP file. Open a command line in
the /build subfolder and call

cmake -G"Visual Studio 10" ..

Then do a

cmake --build .

Watch how test1.cpp is compiled properly. Then open CMakeLists.txt and uncomment
the line with test2.cpp. Do an incremental build by calling

cmake --build .

The change of CMakeLists.txt is detected but test2.cpp is NOT COMPILED! Do a
second incremental build

cmake --build .

Now test2.cpp is compiled.

Delete the bugreport folder and extract it again from the ZIP file to return to
the initial state. Open the CMakeLists.txt and rename the 'Notworking' target
name in add_library to 'working'. Repeat all steps above and you will see that
test2.cpp is compiled in the first incremental build already, as one would
expect.

I tested a lot of combinations and it seems that the capital letter in front
seems to be the source of the problem.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-09-21 10:54 Johannes Asal  New Issue                                    
2015-09-21 10:54 Johannes Asal  File Added: bugreport.zip                    
======================================================================



More information about the cmake-developers mailing list