[CMake] Re: Why prefer ADD_SUBDIRECTORY to SUBDIRS ?

Bill Hoffman bill.hoffman at kitware.com
Mon Aug 20 15:06:01 EDT 2007


Colin D Bennett wrote:
> Christian Convey wrote:
>   
>> The online help says that we should use ADD_SUBDIRECTORY rather than
>> SUBDIRS, but that SUBDIRS still works.
>>
>> Does anyone know why we're supposed to prefer ADD_SUBDIRECTORY?
>>     
>
> Perhaps there is an effort to use consistent naming for command names,
> where the name is a _verb_ describing the command.
>
> Most (but not all) of the CMake command names are verbs. For example:
> Try_run, Set_target_properties, Execute_process, Find_library, Include.
>   
SUBDIRS is processed at the end of the current CMakeLists.txt file.  
ADD_SUBDIRECTORY is
done immediately. So, if you set variables in the parent directory they 
will not be seen in the subdir when
SUBDIRS is used.  

-Bill



More information about the CMake mailing list