ITK CMake Style
From KitwarePublic
Jump to navigationJump to search
I propose the following, starting with Version 4.0 (since this will break backward compatibility of cmake files and user options):
- 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 (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
- Individual options offered in Code/Review and 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 below.
- 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
- 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 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 this var
- Once options move from Review into ITK proper, their individual cmake vars go away.
- 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 (hidden unless advance option in cmake is selected)
- Default value is OFF
- Add options 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.
- CMake vars are considered to be "expensive" to add and maintain. That is, they should not be added unless absolutely necessary