[CMake] Installing FindCGAL.cmake

Alexander Neundorf a.neundorf-work at gmx.net
Fri Nov 14 12:59:06 EST 2008


On Friday 14 November 2008, Fernando Cacciola wrote:
> Hi,
>
> In preparing the cmake build system for CGAL I'm having this issue:
>
> Users can define CGAL_DIR explicitely when configuring their own
> programs in order to allow find_package(CGAL) to locate CGALConfig.cmake.
>
> OTOH, if FindCGAL.cmake is in the cmake modules path, they don't need to
> define CGAL_DIR at all.
>
> However, I'm not sure how to go about installing FindCGAL.cmake.

Short answer: don't do it.

Long answer: in case CGAL is not installed on the system, then there will be 
no FindCGAL.cmake on the system, i.e. there is nothing which would tell you 
that CGAL is not installed. Only once CGAL would be installed, there would be 
a FindCGAL.cmake, and once you find this you have found CGAL anyway.

It is not recommended (i.e. you really should not) to install custom 
FindFoo.cmake files into the system cmake modules directory. The files there 
belong to one specific cmake version, this may break things if you upgrade 
cmake/install an additional version of cmake etc.

Instead I suggest:
install a FooConfig.cmake in one of the recommended directories (e.g. 
lib/foo/cmake/, check the documentation of 2.6.x for details) and 
additionally provide (e.g. on your website) a FindFoo.cmake script, which 
basically only loads FooConfig.cmake and which can optionally have some nicer 
output etc.

Alex


More information about the CMake mailing list