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

-- 

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