[cmake-developers] [CMake 0015666]: Ninja may unnecessarily relink on windows

Mantis Bug Tracker mantis at public.kitware.com
Tue Jul 28 05:56:06 EDT 2015


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15666 
====================================================================== 
Reported By:                Nils Gladitz
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15666
Category:                   (No Category)
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-07-28 05:56 EDT
Last Modified:              2015-07-28 05:56 EDT
====================================================================== 
Summary:                    Ninja may unnecessarily relink on windows
Description: 
I have the following windows specific test case:

cmake_minimum_required(VERSION 3.3)

project(Foo CXX)

if(NOT EXISTS test.cpp)
	file(WRITE test.cpp "__declspec(dllexport) void foo() {}")
endif()

add_custom_target(touch
	COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_SOURCE_DIR}/test.cpp
)

add_library(foo SHARED test.cpp)

Steps to Reproduce: 
I configured the given test project with the "Ninja" generator from a "Visual
Studio 2013 (x64)" environment.

1. ninja # builds the project as expected
2. ninja # outputs "ninja: no work to do." as expected
3. ninja touch # touches test.cpp
4. ninja # recompiles and relinks as expected
5-n. ninja # unexpectedly relinks; expected is "ninja: no work to do."



Additional Information: 
It looks like the relink happens because the linker updates foo.dll but does not
touch foo.lib.

Which leads to (ninja -d explain):

ninja explain: output foo.lib older than most recent input
CMakeFiles/foo.dir/test.cpp.obj (459779794 vs 459780205)
ninja explain: foo.dll is dirty
[1/1] Linking CXX shared library foo.dll
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-07-28 05:56 Nils Gladitz   New Issue                                    
======================================================================



More information about the cmake-developers mailing list