List:Commits« Previous MessageNext Message »
From:Vladislav Vaintroub Date:February 4 2011 1:42pm
Subject:RE: review of bug#42969
View as plain text  

> -----Original Message-----
> From: Joerg Bruehe [mailto:joerg.bruehe@stripped]
> Sent: Freitag, 4. Februar 2011 12:23
> To: Guilhem Bichot
> Cc: commits
> Subject: Re: review of bug#42969
> Hello Guilhem,

> Probably, that is the result of "@ONLY":
> For most of cmake's variables, simply using them "${CMAKE_SYSTEM}" is
> not enough, you first need the "SET" line:

Joerg, Guilhem.

Maybe it makes things a bit cleared with my explanation, I'll try .. 

Apart from cmake main functionality to be used to build software, It can be used just as 
normal  portable scripting language.

The classic program in cmake scripting language  would look like 
hello.cmake : 
MESSAGE(STATUS "hello, world")

You can run it with 
cmake -P  hello.cmake

When cmake is in script mode as above, it does not have build-related  context, nothing
 CMAKE_BUILD_DIR , or CMAKE_C_COMPILER_ID . It does not do system introspection, it does
have CMakeCache.txt to get variables from,  it cannot do ADD_EXECUTABLE or ADD_LIBRARY
commands are not scriptable), and it has  zero builtin variables

Often it is desirable to run cmake scripts (cmake -P) as part of make, in places where
people would 
otherwise use non-portable bourne shell scripts or non-portable batch files otherwise. it
is often required
to have build-related  variables (buld directory etc)  in those scripts. 

"Configure file during cmake and run during make" is standard trick to accomplish that. 

For example.

A script to be configured could look like  :

In build it would be used like this : 

# Configure file during cmake

# After configure content of hello.cmake is 

# Run configured file during make
 # ^ this is cmake -P hello.cmake


review of bug#42969Guilhem Bichot4 Feb
  • Re: review of bug#42969Joerg Bruehe4 Feb
    • RE: review of bug#42969Vladislav Vaintroub4 Feb
      • Re: review of bug#42969Guilhem Bichot4 Feb
        • RE: review of bug#42969Vladislav Vaintroub4 Feb
    • Re: review of bug#42969Guilhem Bichot4 Feb