Hi All,

I've updated to CMake 3-RC6 and seem to be getting a lot of CMP0028 policy 
warnings that I'm not sure I understand. I'm sure I'm doing something wrong of 
misunderstanding what's happening under the hood but would appreciate some 
enlightenment.

Trying to boil it down to a simple example...

# I've have a base library which has dependencies to many Qt components
# BUILD_SHARED_LIBS = ON
find_package(Qt5<Blah>)...
add_library(mybaselib ${SOURCES})
qt5_use_modules(mybaselib Core Widgets Qml Quick Xml XmlPatterns Designer 
Network WebKit WebKitWidgets OpenGL Script Sql)

# I've then got other libraries and programs dependent on this library (and a 
subset of the Qt libs)
find_package(Qt5Core)
find_package(Qt5Widgets)
add_library(myplugin ${SOURCES})
target_link_libraries(myplugin mybaselib)
qt5_use_modules(myplugin Core Widgets)

However CMake 3 is picking up that myplugin should also link to all the 
additional Qt libs from mybaselib:
"Target "myplugin" links to target "Qt5::Sql " but the target was not found. 
Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?"

Which also triggers CMP0028
"Policy CMP0028 is not set: Double colon in target name means ALIAS or IMPORTED 
target. Run "cmake --help-policy CMP0028" for policy details. Use the 
cmake_policy command to set the policy and suppress this warning."

The result being I seem to need to do find_package and qt5_use_modules for all 
the dependencies of the base library in each dependent target. I think this is 
to do with "transitive link dependencies" and INTERFACE_LINK_LIBRARIES?

I didn't think at link time of myplugin I needed anything more than the 
libraries used directly by that target - but I must be wrong, or maybe this is 
true for Windows but not other platforms? Given that all these target do build 
and run fine on Windows and Linux (despite these warnings) this only confirms 
my confusion.

Am I doing something wrong, misunderstanding what's going on or is there some 
better way I need to be structuring this so that people making myplugins don't 
need to know all the dependencies listed for mybaselib.

Thanks
Matt


-- 

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://www.cmake.org/mailman/listinfo/cmake

Reply via email to