[cmake-developers] Specifying sources without file extensions
Craig Scott
craig.scott at crascit.com
Thu Dec 8 01:41:28 EST 2016
I've come across some projects where the source files listed in their
add_executable() and add_library() commands do not have file extensions. It
seems that CMake still finds the sources by trying some set of file
suffixes. This is not documented behaviour, but it does show up in error
messages if you give those commands a file name for a non-existent source.
For example, if I specify a full filename which doesn't exist, I see an
error message similar to the following:
CMake Error at /somepath/CMakeLists.txt:10 (add_library):
Cannot find source file:
../somethingThatDoesNotExist.h
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
So my question is whether specifying source file names without extensions
is a feature which is simply missing documentation or is it an undocumented
feature that projects are not supposed to use? Since there are error
messages like the above, it would seem that the latter would be a harder
position to justify.
--
Craig Scott
Melbourne, Australia
https://crascit.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20161208/2ba3ff0d/attachment.html>
More information about the cmake-developers
mailing list