Re: [CMake] How to list user-definable CMake variables

2010-09-28 Thread Michael Wild

On 28. Sep, 2010, at 9:33 , Marcel Loose wrote:

 Hi all,
 
 I was wondering how I could generate a list of user-definable CMake
 variables. This list, with a brief help per variable, would be *very*
 useful for the end-user. It's a bit like the well-known configure
 --help which gives you a overview of all variables that can be set.
 
 Best regards,
 Marcel Loose.

Is cmake -LAH what you want?

Michael

--
There is always a well-known solution to every human problem -- neat, 
plausible, and wrong.
H. L. Mencken



PGP.sig
Description: This is a digitally signed message part
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] How to list user-definable CMake variables

2010-09-28 Thread Marcel Loose

On 28. Sep, 2010, at 9:33 , Marcel Loose wrote:

  Hi all,
  
  I was wondering how I could generate a list of user-definable CMake
  variables. This list, with a brief help per variable, would be
*very*
  useful for the end-user. It's a bit like the well-known configure
  --help which gives you a overview of all variables that can be set.
  
  Best regards,
  Marcel Loose.

 Is cmake -LAH what you want?
 
 Michael

Hi Michael,

Well this is sort of what I was looking for, though I was hoping that it
would be possible to list any useful variable *before* running CMake.

Is there some kind of hook, e.g. 'cmake --custom-help', that can be used
to display project-specific help. The help text should be provided by
the developer, of course.

Best regards,
Marcel Loose.


___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] How to list user-definable CMake variables

2010-09-28 Thread Eric Noulard
2010/9/28 Marcel Loose lo...@astron.nl:

 On 28. Sep, 2010, at 9:33 , Marcel Loose wrote:

  Hi all,
 
  I was wondering how I could generate a list of user-definable CMake
  variables. This list, with a brief help per variable, would be
 *very*
  useful for the end-user. It's a bit like the well-known configure
  --help which gives you a overview of all variables that can be set.
 
  Best regards,
  Marcel Loose.

 Is cmake -LAH what you want?

 Michael

 Hi Michael,

 Well this is sort of what I was looking for, though I was hoping that it
 would be possible to list any useful variable *before* running CMake.

Before running cmake... I don't know but keep reading.

 Is there some kind of hook, e.g. 'cmake --custom-help', that can be used
 to display project-specific help. The help text should be provided by
 the developer, of course.

You may do the following:

Write an HelpMe.cmake file which contains CMake comments
just like plain CMake do (see e.g. CPackRPM.cmake which contains many
variable descriptions)

then add the following custom target to your project:
add_custom_target(HelpMe
  COMMAND  ${CMAKE_COMMAND}
-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} --help-module HelpMe
  COMMENT Display User defined help)

this will use the --help-module option of cmake to display your custom help.

user can call the target

make HelpMe

and the help will be display.

You may want to call your target help but it would conflict/override
the cmake builtin help target
(at least for makefile generator) which display the list of available target.

This work AFTER cmake has been run. It could be run before as well using:

cmake -DCMAKE_MODULE_PATH=/path/to/source --help-module HelpMe

but this is awkward :-(

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] How to list user-definable CMake variables

2010-09-28 Thread Michael Wild

On 28. Sep, 2010, at 10:12 , Marcel Loose wrote:

 
 On 28. Sep, 2010, at 9:33 , Marcel Loose wrote:
 
 Hi all,
 
 I was wondering how I could generate a list of user-definable CMake
 variables. This list, with a brief help per variable, would be
 *very*
 useful for the end-user. It's a bit like the well-known configure
 --help which gives you a overview of all variables that can be set.
 
 Best regards,
 Marcel Loose.
 
 Is cmake -LAH what you want?
 
 Michael
 
 Hi Michael,
 
 Well this is sort of what I was looking for, though I was hoping that it
 would be possible to list any useful variable *before* running CMake.
 
 Is there some kind of hook, e.g. 'cmake --custom-help', that can be used
 to display project-specific help. The help text should be provided by
 the developer, of course.
 
 Best regards,
 Marcel Loose.

Not that I'd know of. I also think that this would be quite difficult to 
implement. You're far better off writing an extensive README or INSTALL 
document.

Michael

--
There is always a well-known solution to every human problem -- neat, 
plausible, and wrong.
H. L. Mencken



PGP.sig
Description: This is a digitally signed message part
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] How to list user-definable CMake variables

2010-09-28 Thread Marcel Loose
On Tue, 2010-09-28 at 10:43 +0200, Michael Wild wrote:
 On 28. Sep, 2010, at 10:12 , Marcel Loose wrote:
 
  
  On 28. Sep, 2010, at 9:33 , Marcel Loose wrote:
  
  Hi all,
  
  I was wondering how I could generate a list of user-definable
CMake
  variables. This list, with a brief help per variable, would be
  *very*
  useful for the end-user. It's a bit like the well-known configure
  --help which gives you a overview of all variables that can be
set.
  
  Best regards,
  Marcel Loose.
  
  Is cmake -LAH what you want?
  
  Michael
  
  Hi Michael,
  
  Well this is sort of what I was looking for, though I was hoping
that it
  would be possible to list any useful variable *before* running
CMake.
  
  Is there some kind of hook, e.g. 'cmake --custom-help', that can be
used
  to display project-specific help. The help text should be provided
by
  the developer, of course.
  
  Best regards,
  Marcel Loose.
 
 Not that I'd know of. I also think that this would be quite difficult
to implement. You're far better off writing an extensive README or
INSTALL document.
 
 Michael
 
 --
 There is always a well-known solution to every human problem -- neat,
plausible, and wrong.
 H. L. Mencken
 
That's a pity.

Of course there's nothing against having a good, useful README and/or
INSTALL file. But I also like to keep the documentation close to the
code. The more documentation and code get separated, the higher the risk
that the two diverge.

Anyway, thanks for thinking with me.

Best regards,
Marcel Loose.

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] How to list user-definable CMake variables

2010-09-28 Thread Marcel Loose
On Tue, 2010-09-28 at 10:42 +0200, Eric Noulard wrote:
 2010/9/28 Marcel Loose lo...@astron.nl:
 
  On 28. Sep, 2010, at 9:33 , Marcel Loose wrote:
 
   Hi all,
  
   I was wondering how I could generate a list of user-definable
CMake
   variables. This list, with a brief help per variable, would be
  *very*
   useful for the end-user. It's a bit like the well-known
configure
   --help which gives you a overview of all variables that can be
set.
  
   Best regards,
   Marcel Loose.
 
  Is cmake -LAH what you want?
 
  Michael
 
  Hi Michael,
 
  Well this is sort of what I was looking for, though I was hoping
that it
  would be possible to list any useful variable *before* running
CMake.
 
 Before running cmake... I don't know but keep reading.
 
  Is there some kind of hook, e.g. 'cmake --custom-help', that can be
used
  to display project-specific help. The help text should be provided
by
  the developer, of course.
 
 You may do the following:
 
 Write an HelpMe.cmake file which contains CMake comments
 just like plain CMake do (see e.g. CPackRPM.cmake which contains many
 variable descriptions)
 
 then add the following custom target to your project:
 add_custom_target(HelpMe
   COMMAND  ${CMAKE_COMMAND}
 -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} --help-module HelpMe
   COMMENT Display User defined help)
 
 this will use the --help-module option of cmake to display your
custom help.
 
 user can call the target
 
 make HelpMe
 
 and the help will be display.
 
 You may want to call your target help but it would conflict/override
 the cmake builtin help target
 (at least for makefile generator) which display the list of available
target.
 
 This work AFTER cmake has been run. It could be run before as well
using:
 
 cmake -DCMAKE_MODULE_PATH=/path/to/source --help-module HelpMe
 
 but this is awkward :-(
 
Thanks Erk,

I'll give it a thought. Your solution uses some nice CMake features, but
I find it a bit awkward. It suffers from separation of code and
documentation, though. That's always risky, since the two are likely to
diverge.

Best regards,
Marcel Loose.


___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] How to list user-definable CMake variables

2010-09-28 Thread Michael Wild

On 28. Sep, 2010, at 11:03 , Marcel Loose wrote:

 On Tue, 2010-09-28 at 10:43 +0200, Michael Wild wrote:
 On 28. Sep, 2010, at 10:12 , Marcel Loose wrote:
 
 
 On 28. Sep, 2010, at 9:33 , Marcel Loose wrote:
 
 Hi all,
 
 I was wondering how I could generate a list of user-definable
 CMake
 variables. This list, with a brief help per variable, would be
 *very*
 useful for the end-user. It's a bit like the well-known configure
 --help which gives you a overview of all variables that can be
 set.
 
 Best regards,
 Marcel Loose.
 
 Is cmake -LAH what you want?
 
 Michael
 
 Hi Michael,
 
 Well this is sort of what I was looking for, though I was hoping
 that it
 would be possible to list any useful variable *before* running
 CMake.
 
 Is there some kind of hook, e.g. 'cmake --custom-help', that can be
 used
 to display project-specific help. The help text should be provided
 by
 the developer, of course.
 
 Best regards,
 Marcel Loose.
 
 Not that I'd know of. I also think that this would be quite difficult
 to implement. You're far better off writing an extensive README or
 INSTALL document.
 
 Michael
 
 --
 There is always a well-known solution to every human problem -- neat,
 plausible, and wrong.
 H. L. Mencken
 
 That's a pity.
 
 Of course there's nothing against having a good, useful README and/or
 INSTALL file. But I also like to keep the documentation close to the
 code. The more documentation and code get separated, the higher the risk
 that the two diverge.
 
 Anyway, thanks for thinking with me.
 
 Best regards,
 Marcel Loose.
 


Of course, it would be ideal if CMake had a way of spewing out all the 
documentation strings of all the cache variables, but IMHO this is nigh 
impossible, e.g. what do you do with conditionally set cache variables? If you 
treat them as being unconditional, you might accidentally offer too many 
options which don't have any effect (perhaps it's a conditional on WIN32 or 
similar), or you might have conflicts (e.g. different doc strings and default 
values for WIN32 and UNIX).

Michael

--
There is always a well-known solution to every human problem -- neat, 
plausible, and wrong.
H. L. Mencken



PGP.sig
Description: This is a digitally signed message part
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] How to list user-definable CMake variables

2010-09-28 Thread Eric Noulard
2010/9/28 Marcel Loose lo...@astron.nl:

 You may want to call your target help but it would conflict/override
 the cmake builtin help target
 (at least for makefile generator) which display the list of available
 target.

 This work AFTER cmake has been run. It could be run before as well
 using:

 cmake -DCMAKE_MODULE_PATH=/path/to/source --help-module HelpMe

 but this is awkward :-(

 Thanks Erk,

 I'll give it a thought. Your solution uses some nice CMake features, but
 I find it a bit awkward. It suffers from separation of code and
 documentation, though. That's always risky, since the two are likely to
 diverge.

It is a little bit, but you can put in this custom cmake file
(you may rename it to CustomizableOptions.cmake)
any CMake *code* you want including the definition of OPTION or vars
(using SET) etc...

then in you CMakeLists.txt you can

include(CustomizableOptions.cmake)

and the header of the file contains the useful doc. for the
concerned option/vars.

then the code and it's doc stay together.




-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] How to list user-definable CMake variables

2010-09-28 Thread Kelly Thompson
Marcel,

We use a 'bootstrap' CMakeCache.txt file that has README-like full
documentation for each user settable variable.  This way a new developer can
copy the bootstrap CMakeCache.txt file to his/her build directory and edit
the file variable-by-variable before running cmake.

Something like:

# CMakeCache.txt - bootstrap file for new builds.

# Instructions.
# 1. Copy this file to your build directory as CMakeCache.txt.
# 2. Review and update all values in this file.
# 3. Environment must have $FC set to one of { ifort, gfortran or pathf90 }
# 4. From the build directory run 'cmake /full/path/to/source'

# Location where 'make install' will copy files to.
CMAKE_INSTALL_PREFIX:PATH=/full/path/to/target/directory

# CMAKE_BUILD_TYPE == { Release, Debug, RelWithDebInfo, MinSizeRel }
CMAKE_BUILD_TYPE:STRING=Release

# CMAKE_GENERATOR == { NMake Makefiles, Unix Makefiles, Visual Studio 9
2008, Visual Studio 9 2008 Win64 }
CMAKE_GENERATOR:STRING=Unix Makefiles

etc.

Maybe that is too clunky for you -- but has worked well for us.

-kt

 -Original Message-
 From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf
Of
 Eric Noulard
 Sent: Tuesday, September 28, 2010 3:12 AM
 To: Marcel Loose
 Cc: cmake@cmake.org; them...@gmail.com
 Subject: Re: [CMake] How to list user-definable CMake variables
 
 2010/9/28 Marcel Loose lo...@astron.nl:
 
  You may want to call your target help but it would conflict/override
  the cmake builtin help target
  (at least for makefile generator) which display the list of available
  target.
 
  This work AFTER cmake has been run. It could be run before as well
  using:
 
  cmake -DCMAKE_MODULE_PATH=/path/to/source --help-module HelpMe
 
  but this is awkward :-(
 
  Thanks Erk,
 
  I'll give it a thought. Your solution uses some nice CMake features, but
  I find it a bit awkward. It suffers from separation of code and
  documentation, though. That's always risky, since the two are likely to
  diverge.
 
 It is a little bit, but you can put in this custom cmake file
 (you may rename it to CustomizableOptions.cmake)
 any CMake *code* you want including the definition of OPTION or vars
 (using SET) etc...
 
 then in you CMakeLists.txt you can
 
 include(CustomizableOptions.cmake)
 
 and the header of the file contains the useful doc. for the
 concerned option/vars.
 
 then the code and it's doc stay together.
 
 
 
 
 --
 Erk
 Membre de l'April - « promouvoir et défendre le logiciel libre » -
 http://www.april.org
 ___
 Powered by www.kitware.com
 
 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html
 
 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ
 
 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] How to list user-definable CMake variables

2010-09-28 Thread Alexander Neundorf
On Tuesday 28 September 2010, Marcel Loose wrote:
 Hi all,

 I was wondering how I could generate a list of user-definable CMake
 variables. This list, with a brief help per variable, would be *very*
 useful for the end-user. It's a bit like the well-known configure
 --help which gives you a overview of all variables that can be set.

Run cmake-gui, and check which variables appear after the first configure run 
in the non-advanced section. This should be the variables intended to be 
changed by the user (the one who compiles)

Alex
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake