[cmake-developers] Supporting imported targets in CHECK_CXX_SOURCE_COMPILES() and friends

Alexander Neundorf neundorf at kde.org
Mon Jul 18 16:13:49 EDT 2011


Hi,

in KDE we have a copy of CHECK_CXX_SOURCE_COMPILES() which supports imported 
targets in CMAKE_REQUIRED_LIBRARIES:
http://websvn.kde.org/branches/KDE/4.5/kdelibs/cmake/modules/CheckCXXSourceCompiles.cmake?revision=1143427&view=markup
http://websvn.kde.org/branches/KDE/4.5/kdelibs/cmake/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake?view=markup

This means, you can put any ${FOO_LIBRARY} you got from some find-module into 
CMAKE_REQUIRED_LIBRARIES and it will work, also if ${FOO_LIBRARY} is actually 
an imported target and not a path to a library.

It works for us in KDE and I am not aware of problems with it. Also, the 
number of imported targets is increasing, by more and more projects installing 
Config.cmake files, so this is getting more important.

I can remember that quite some time ago I suggested to merge this into cmake, 
but there were objections. I can't remember what the objections were, well, 
actually I don't see a reason not to have that in cmake.

So, do these objections still exist or can I merge that into cmake ?

Alex



More information about the cmake-developers mailing list