Thanks for the info Philip. I would like to make this as close to the
accepted convention as possible so that this might potentially get accepted
into the CMake distribution if I ever decide to submit it. My scripts are
fairly simple and untested on multiple operating systems and build systems.
I do not have the means to test these scripts as extensively as I should.
But then again, I'm not sure how the CMake developers test find modules.
I'm assuming that the macro in question will automatically mark all cache
variables as advanced. Is this the case?

@Mike Jackson
Thank you for this info. I forgot about that function.

There seems to be an inconsistency in naming convention. For example, the
set() function uses the term INTERNAL to represent a "hidden" cache
variable. However, the function mark_as_advanced() is using the term
"advanced". What I would like to see is one of the following pairs:

set( CACHE ADVANCED )
mark_as_advanced()

 - OR -

set( CACHE INTERNAL )
mark_as_internal()

Does this make sense, or am I misunderstanding the difference between the
two?

On Thu, Mar 26, 2009 at 8:18 PM, Philip Lowman <phi...@yhbt.com> wrote:

> On Thu, Mar 26, 2009 at 6:52 PM, Robert Dailey <rcdai...@gmail.com> wrote:
>
>> First of all, I've created a find module called FindglFont2.cmake. Below
>> are the contents:
>> find_path( glFont2_INCLUDE_DIRS glfont2.h )
>> find_library( glFont2_LIBRARIES NAMES glfont2 )
>>
>> set( glFont2_FOUND FALSE )
>> if( glFont2_LIBRARIES AND glFont2_INCLUDE_DIRS )
>>   set( glFont2_FOUND TRUE )
>> endif()
>>
>
> Robert,
>
> Just a minor suggestion... the second snippit of code above can be replaced
> with the following provided you're using CMake 2.6.0 or later.  This will
> also handle some of the options to find_package() like QUIET and REQUIRED.
>
> include(FindPackageHandleStandardArgs)
> FIND_PACKAGE_HANDLE_STANDARD_ARGS(glFont2 DEFAULT_MSG glFont2_INCLUDE_DIRS
> glFont2_LIBRARIES)
>
> Also, convention is to use the singular form for xxx_INCLUDE_DIR and
> xxx_LIBRARY when using find_path() and find_library() and then manually set
> the plural variables xxx_INCLUDE_DIRS and xxx_LIBRARIES.  This makes more
> sense when the user is editing the cache and also allows the find module to
> grow in a backwards compatible manor if the library is ever refactored into
> two separate libraries in a later release.
>
> --
> Philip Lowman
>
_______________________________________________
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

Reply via email to