[CMake] Some suggestions to TestForPosix module I wrote

David Cole david.cole at kitware.com
Thu Dec 15 05:36:10 EST 2011



On Dec 15, 2011, at 3:23 AM, "Rolf Eike Beer" <eike at sf-mail.de> wrote:

>> I wrote a TestForPosix module for looking if the system supports a POSIX /
>> XPG / SUS standard and I wanted for you experts to look and criticize if
>> you find anything wrong. I would also ask how can I make a request for it
>> to be included in CMake 2.8.7, because it is (in my opinion) a very good
>> contribution to the CMakeModules...
>> 
>> Well, here is the download link (unix line feeds):
>> 
>> http://ge.tt/8CVeNDB
>> 
>> Only put it in the Modules folder of CMake if you want to test (otherwise
>> you'll have to configure the path to the .in file...)
> 
> This looks like a good idea, however I found it to duplicate much code.
> 
> Here are some suggestions:
> 
> -make the thing a function, not a macro. You need to set the result
> variable using set(... PARENT_SCOPE) then.
> 
> -use RETURN() in the else() to get out of the function when the user
> requests a bad standard.
> 
> -I would use a SEND_ERROR in this case since the CMakeLists.txt is clearly
> broken and needs to be fixed.
> 
> -now move the message() and configure_file() from each if() behind the
> whole if() so it is shared by all valid standards.
> 
> Greetings,
> 
> Eike
> --
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


Eike's advice is good, but even so, it's too late for this contribution to appear in 2.8.7. If it gets into 'master', the earliest release it could appear in will be the one after that: probably 2.8.8.



More information about the CMake mailing list