[Insight-developers] cmake vars

Stephen Aylward Stephen.Aylward at Kitware.com
Sun Aug 24 10:30:44 EDT 2008


We're developing a confusing morass of cmake vars.  The situation is
getting worse: increasing the steepness of the learning curve for new
users, confounding the testing process, and hindering the community's
review and use of the new features in ITK.

We have no policy or style-guide for cmake vars.   We need one.  I've
started one below and on the wiki at
(http://www.itk.org/Wiki/ITK_CMake_Style):

I propose the following, starting with Version 4.0 (since this will
break strict-backward compatibility of cmake files and user options):

1) There is one cmake var that controls all features in the review
directory ITK_USE_REVIEW
      -- It should be a standard (not an advanced) cmake var  (i.e.,
you should see it even without turning on advanced option in cmake)
      -- If it is on, then all options within Code/Review are enabled.
      -- Default value is OFF

2) Individual options offered in Code/Review that CHANGE the current
behavior of ITK may also have a CMake var that can be turn on to
enable just that feature
      -- If the feature only EXTENDS ITK's functionality, there is no
need to create a cmake var for it - those Extensions are discussed in
the next section.
      -- Variable names should begin with ITK_REVIEW  (e.g.,
ITK_REVIEW_OPTIMIZED_REGISTRATION_METHODS)
      -- If ITK_USE_REVIEW is on, then these options are built
regardless of their individual var setting
      -- if ITK_USE_REVIEW is off, then these options are built if
their individual vars are turned on
      -- Default value is OFF for all such vars

3) Code/Review options that EXTEND the current behavior of ITK's are
grouped into a single CMake var call ITK_REVIEW_EXTENSIONS
      -- This is an advanced var
      -- If ITK_USE_REVIEW is on, then these options are built
regardless of this var's setting
      -- if ITK_USE_REVIEW is off, then these options are built if
this var is turned on
      -- Default value is OFF for this var

4) Once options move from Code/Review into ITK proper, their
individual cmake var (e.g., ITK_REVIEW_BLAH, if it exists) goes away.

5) All options that require external packages will be listed as
ITK_USE_<PACKAGE_NAME>  (e.g., ITK_USE_FFTW)
     -- Such cmake vars are Advanced vars (i.e., hidden unless advance
option in cmake is selected)
     -- Default value is OFF

6) CMake vars specific to an external package must be lists as
ITK_<PACKAGE_NAME>_VAR (e.g., ITK_FFTW_USE_GPU) or as
<PACKAGE_NAME>_VAR (e.g., FFTW_USE_GPU) and be marked as advanced.

5) CMake vars are considered "expensive" to add, use, and maintain.
That is, they should not be added unless absolutely necessary -

I've placed this on the wiki at
http://www.itk.org/Wiki/ITK_CMake_Style

Stephen

-- 
Stephen R. Aylward, Ph.D.
Chief Medical Scientist
Kitware, Inc. - North Carolina Office
http://www.kitware.com
(518) 371-3971 x300


More information about the Insight-developers mailing list