Hi,

On 11/23/2010 at 21:25, Alexander Neundorf <a.neundorf-w...@gmx.net> wrote: 
> CMAKE_MODULE_PATH is only for finding Find-modules, not for finding the 
> actual packages or Config-files.
> For that you can set CMAKE_PREFIX_PATH. CMake uses each directory contained 
> in CMAKE_PREFIX_PATH for all its find_program/file/path/library/package() 
> calls to search in the respective subdirectories for the 
> executables/files/libraries/Config-files.

Thanks for this information! Knowing this greatly simplifies the whole 
find_package stuff...

>> And is there any documentation on how to create a LibraryConfig.cmake file
>> with support for components?
> 
> In KDE we have a macro MACRO_WRITE_BASIC_CMAKE_VERSION_FILE() which helps 
> with creating a basic version-info file which should be installed along 
> with the Config-file.
> It consists of MacroWriteBasicCMakeVersionFile.cmake and 
> BasicFindPackageVersion.cmake.in which you can find in 
> http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/ .

Nice to have some reusable code for versioning...

About the components question again: I played around a bit, and I think I 
now more or less have comprehended this. I guess for a package XXX with 
components YYY and ZZZ, one could set variables XXX_HAS_YYY and XXX_HAS_ZZZ
and then use a loop like this one in the XXXConfig.cmake file:

foreach( component ${XXX_FIND_COMPONENTS} )
    if ( XXX_HAS_${component})
        set ( XXX_${component}_FOUND TRUE )
    else( XXX_HAS_${component})
        if ( ${XXX_FIND_REQUIRED})
            message(FATAL_ERROR "Required component ${component} not found!")
        elseif ( NOT XXX_FIND_QUIETLY)
            message(STATUS "Component ${component} not found!")
        endif ( ${XXX_FIND_REQUIRED})
    endif ( XXX_HAS_${component})
endforeach( component )

Correct?

Cheers,
  Johannes


-- 
Johannes Zarl
Virtual Reality Services

Johannes Kepler University
Informationsmanagement

Altenbergerstrasze 69
4040 Linz, Austria
Phone: +43 732 2468-8321
johannes.z...@jku.at
http://vrc.zid.jku.at










_______________________________________________
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