[cmake-developers] Making Config.cmake files safer

Alexander Neundorf neundorf at kde.org
Sat Nov 12 12:19:18 EST 2011


Hi,

I added a branch CheckImportedFileExistenceInConfigDotCMakeFiles cmake stage.

In this branch, the files created for exported targets by cmake contain extra 
checks to verify that the files which are being imported actually exist on 
disk.
In theory they always should.

But for whatever reason this is not 100% safe.
People might manually delete the library file, or packages created by distros 
may have split a project wrong into normal and development package.
In such cases it can happen that the Config.cmake file is there, but the 
actual library is not.
(this actually happened to me with a pkg-config pc-file on SUSE, the pc-file 
was installed, the development package wasn't).

To protect against such problems, there is a check file(EXISTS) in the 
installed files in this branch, so whoever hits that problem, gets an error 
message at cmake time, stating that the file does not exist, instead of a 
failure at build time.

Do you think this makes sense ?

Ok to merge ?

Alex



More information about the cmake-developers mailing list