[cmake-developers] Need some pointers on learning the code

Brad King brad.king at kitware.com
Mon May 13 09:28:41 EDT 2013


On 05/12/2013 07:32 PM, Robert Dailey wrote:
> I'm currently working on adding a CONFIG keyword to the
> add_custom_command() command.

The need for a CONFIG keyword was largely removed by support for
generator expressions in custom commands.

There is discussion and and old patch here:

 http://www.cmake.org/Bug/view.php?id=9974

There is also discussion of adding support in OUTPUT and DEPENDS
for generator expressions:

 http://www.cmake.org/Bug/view.php?id=13840

With that one would almost never need the CONFIG keyword.

> I'm not familiar with the code at all.
> Right now I'm trying to figure out how CMake handles configurations
> for Visual Studio. Are they handled only in the Generate() function?
> Or does the configuration step also have knowledge of them?

There are two kinds of generators:

* Single configuration, determined by CMAKE_BUILD_TYPE at
  config time.  All Makefile generators and Ninja work this way.

* Multiple configuration, listed by CMAKE_CONFIGURATION_TYPES
  at config time but the final configuration is selected at
  build time by the native tool.  The Xcode and VS generators
  work this way.

Therefore CMake commands cannot know the build configuration,
but generators do.  The multi-config generators write out all
the supported configs and typically loop over them.

-Brad



More information about the cmake-developers mailing list