[cmake-developers] Adding automatic checks for required targets in target-export files ?

Alexander Neundorf neundorf at kde.org
Sat Feb 9 04:30:03 EST 2013


Hi,

a few weeks ago I added the feature that within one project, you can export 
depending targets into separate exports.
When doing that, cmake now automatically adds a check whether the required 
targets (which were exported in a different export set) exist:

if(NOT TARGET foolib )
   message(FATAL_ERROR "Required imported target foolib not found !")
endif()


This is nice.

But this is not done for other required targets, which were imported targets 
already in the exporting project (e.g. if libkcoreaddons has Qt5::Core in its 
LINK_INTERFACE).

IMO it would be nice if cmake automatically would create the same check as 
above for targets from the same project.
I'm not sure whether this could cause build breakage... I think suddenly the 
order of the find_package() calls would become more important, the needed 
projects would have to be searched before...

Or is that already done now in some branch ?
I lost a bit track of the other threads...

Alex



More information about the cmake-developers mailing list