[cmake-developers] [CMake 0015907]: [ninja] wrong dependency management with imported targets from external project or custom target

Mantis Bug Tracker mantis at public.kitware.com
Sun Jan 10 11:15:57 EST 2016


The following issue has been SUBMITTED. 
====================================================================== 
https://cmake.org/Bug/view.php?id=15907 
====================================================================== 
Reported By:                Philippe
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15907
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2016-01-10 11:15 EST
Last Modified:              2016-01-10 11:15 EST
====================================================================== 
Summary:                    [ninja] wrong dependency management with imported
targets from external project or custom target
Description: 
Here is a simple CMakeLists to reproduce my problem:

    # in my case, this line is actually an ExternalProject_Add
    add_custom_target(outfile COMMAND gcc ${CMAKE_CURRENT_SOURCE_DIR}/lib.c
-shared -o liboutfile.so)

    add_library( mylib SHARED IMPORTED )
    set_property( TARGET mylib PROPERTY IMPORTED_LOCATION liboutfile.so )
    add_dependencies( mylib outfile )

    add_executable( testexe test.c )
    target_link_libraries( testexe mylib )

This ensures that before we try to link with the mylib target, the outfile
target is built. Except it works only with the Unix Makefiles generator but not
with the Ninja one.

With Ninja I get this error before it tries to do any work:

    ninja: error: 'liboutfile.so', needed by 'testexe', missing and no known
rule to make it

I'm attaching a simple and complete test project to reproduce.

Steps to Reproduce: 
1. download and uncompress the attached testproj
2. configure with the Ninja generator
3. try build with ninja and get an error
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-01-10 11:15 Philippe       New Issue                                    
2016-01-10 11:15 Philippe       File Added: testproj.tar.bz2                    
======================================================================



More information about the cmake-developers mailing list