Re: [AD] cmake reorganization (was: 4.9 on OSX)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2008-02-18, Milan Mimica <milan.mimica@xxxxxxxxxx> wrote:
> Peter Wang wrote:
> > 
> > If you didn't know, pretty much everything is in the top-level
> > CMakeFiles.txt file.  I will try to answer any questions about it.
> 
> I want to discuss this. I had to modify CMakeFiles.txt when adding MSVC 
> support and I've had some hard time to understand how it works. Besides 
> cmake syntax being very ugly IMO, I think there is something that could 
> be done to improve readability.
> 
> First, there is this set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE) 
> directive which supposedly allows more standard
> if(VAR)
>     ...
> else()
>     ...
> endif() style.
> 
> if(VAR)
>     ...
> else(VAR)
>     ...
> endif(VAR) is confusing and unconventional. Perhaps it is easier to see 
> which "endif" belongs to which condition, but that should not be in the 
> syntax. We should force ourselves to add a comment: endif() #VAR.

The problem is you have no guarantee that the comments will be correct.
Unfortunately, AFAIK, if you set CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS then it
simply ignores all the text inside the "else()" and "endif()".  Otherwise I
would use "endif()" style when it is obvious which lines up with what, and
use "endif(VAR)" style when it improves readability.

> Another thing I'd propose is to split CMakeFiles.txt into multiple 
> files. I haven't thought of the structure yet in detail, but I think 
> that each platform should have its own main file (something we used to 
> have with makefiles) and a file(s) containing some common routines.

Depends how you split it, I guess.  I do like having essentially the entire
build all in one file.

There is some cruft in the CMakeFiles.txt which should be deleted, and
some hairy handling of asm files which is no longer needed.  Otherwise I
think it is quite clear, but maybe we need a new set of eyes.

Peter





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/