Giter Site home page Giter Site logo

cmake_implicit_depends's Introduction

small study on dependency treatment in CMake

There are three files: base.h derived.h main.cpp

base.h is a "fake" header. It's include is disabled through the preprocessor options. The executable main should thus be rebuilt whenever main.cpp or derived.h get touched.

The CMake option IMPLICIT_DEPENDS is tested for a custom command. It is set up to have the same depends as main.

The script runall.sh runs CMake a few times (generation and compilation) for both generators and touches files to se what rebuild steps get done/omitted. The results are in the result file.

observation with make

CMake is set up to figure dependencies for C/C++ files out by itself, and doesn't use the gcc preprocessor. It therefore misses that base.h is only for confusion and rebuilds everything when base.h is touched.

It "correctly" applies the same dependencies for the custom command

observation with ninja

With ninja, the compiler's dependency resolution is used instead of the CMake dependency scan. When base.h is touched, no recompilation is done.

Yet, IMPLICIT_DEPENDS is not implemented for the ninja generator, and doesn't recognize the need to rerun grep when derived.h gets touched.

small print

In the runall.sh script, I added a few sleep commands, because ninja runs too fast and the time checking doesn't realise the touch should've happened after the build.

cmake_implicit_depends's People

Contributors

pseyfert avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.