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                                    
======================================================================

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to