The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15101 
====================================================================== 
Reported By:                Björn Piltz
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15101
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-08-22 08:29 EDT
Last Modified:              2014-08-22 08:29 EDT
====================================================================== 
Summary:                    Imported libraries go out of scope after call to
target_link_libraries().
Description: 
I have a project where module lib - a library - depends on Qt, so it calls
find_package(Qt5 ...) and target_link_libraries(lib Qt5::Core). Later I call
target_link_libraries(app lib). 
The cmake configure step runs through without problems, but the generate step
halts with the message:

    Target "app" links to target "Qt5::Core" but the target was not found.
    Perhaps a find_package() call is missing for an IMPORTED target, or an
    ALIAS target is missing?

According to the documentation the target Qt5::Core is out of scope for 'app'
since app is not in a subdirectory of the directory where add_library(...
IMPORTED) was made, but I would argue that this is a bug since the target was in
scope when the call add_library(lib Qt5::Core) was made.

This issue is not specific to Qt and I'm aware that it could be fixed on their
side by calling add_library(... IMPORTED GLOBAL).  I'm hoping it could be fixed
on the cmake side, though.

Steps to Reproduce: 
git clone https://github.com/bjornpiltz/cmake_bug.git cmake_bug
mkdir work
cd work
cmake -DCMAKE_PREFIX_PATH=<Qt5>/lib/cmake/ ../cmake_bug/

Additional Information: 
This issue is platform independent.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-08-22 08:29 Björn Piltz    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