[cmake-developers] Learning from the source

Chuck Atkins chuck.atkins at kitware.com
Fri Apr 18 15:04:10 EDT 2014


Hi Ingwie,

It depends on what exactly you're referring to.  If you mean calls to
find_library and find_path, those usually have a set of known directories
and patterns that they search for.  However, if you're referring to the
configure time checks line CHECK_INCLUDE_FILE and related functions, those
are implemented through try-compiles.  Basically, if you want to check if a
header "foo.h" exists, then a dummy C program just containing the #include
<foo.h> directive and a sub main is generated, and then compiled.  If the
compile is successful, then the header is found.  If it failed, then it
wasn't.  This is essentially the same approach taken for library and
function existence checking.  You can see the details of how it's
implemented by looking in your cmake installation in the Modules folder and
look at the Check*.cmake files.  You can also find the source templates
used for the try-compiles in the same folder, i.e. CheckIncludeFile.cxx.in,
etc.

- Chuck


On Sun, Apr 13, 2014 at 11:40 PM, Kevin Ingwersen <ingwie2000 at googlemail.com
> wrote:

> Hello everyone! This is my first post here, so hopefuly you can understand
> me - because I am not a native english speaker! :)
>
> As the title suggests, I wish to learn one thing or another. Currently, I
> am working on a project that has a good bunch of dependencies. They all
> originate from different build systems - Autotools, GYP, CMake - and are
> therefore pretty individual. So I have searched for a build system that
> works cross-platform and has a nice syntax that makes things look clean.
> Turns out I found one, forked it, and customized it.
>
> But now I am stuck at the configuration part. The program can very nicely
> track dependencies and build properly. However, it has only partial
> integration for configuring (generating config.h’s for example) - and that
> is what I wish to implement. Since CMake supports things as checking for
> includes, libraries, and functions, i wanted to ask how CMake is doing this.
>
> The reason why I ended up asking here is plain simple:
> - GYP has no configuration part at all.
> - Autotools looks to me like I am reading some raw certificate… AKA. I
> just can’t wrap my head around it.
>
> Here are some references, if you need them.
> - The fork of the build system in question:
> https://github.com/IngwiePhoenix/build
> - The project in question: https://github.com/Deskshell-Core/PhoenixEngine
>
> Hopefully I am right here to learn more about the rather complex task of
> probing a system for things! ^-^
>
> Kind regards, Ingwie.
> --
>
> 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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140418/77ce5f77/attachment-0002.html>


More information about the cmake-developers mailing list