← Back to team overview

kicad-developers team mailing list archive

Re: CMakeLists.txt if() else() endif() suggestions

 

On 02/14/2013 08:38 AM, Wayne Stambaugh wrote:
> On 2/14/2013 8:48 AM, Dick Hollenbeck wrote:
>> Recently I have spent much time writing cmake scripts, in the preparation of Python
>> a-mingw-us.
>>
>> I have found CMake's
>>
>>     endif( SOME LONG DUPLICATION )
>>
>> to be both tiresome and a detriment to readability and maintenance of the scripts.
>>
>> CMake does not require content inbetween endif(  *  ).
>>
>> As a personal rule of thumb, what I am currently doing is leaving that text out of the
>> endif() and else() statements if the if() block is say less than 30-40 lines. 
>>
>> It enhances readability and ease of maintenance.  For exceptionally long blocks, or if
>> they are nested, then it may bring some value.
>>
>> FYI,
>>
>> Dick
>>
> Yeah!  Thank you Dick.  I'll be changing it as I make changes to the
> CMake files.  I never care much for endif( SOME LONG DUPLICATION ).  If
> memory serves, CMake would complain if you did not include the content
> in the endif() statement.  Does anyone know version of CMake dropped
> that syntax requirement?

No, but I don't ever remember it complaining about being empty.  I only remember it
complaining on mismatch.




References