[cmake-developers] New Cmake module - Armadillo C++

Alexander Neundorf neundorf at kde.org
Wed Mar 16 15:16:11 EDT 2011


Hi Clement,

On Wednesday 16 March 2011, creusot wrote:
> Hi everybody,
> I would like to propose a new cmake module for the Armadillo C++ library.
>       http://arma.sourceforge.net/
> This library provides fast linear algebra methods with an interface very
> similar to octave code:
>     colvec x = solve(A,b);
>     colvec x = inv(trans(A)*A)*trans(A)*b ;
> I have attached the FindArmadillo.cmake file to this email.
> I propose myself as Module maintainer for Armadillo C++.
> My details: Clement Creusot (creusot at cs.york.ac.uk)
>
> Can you tell me if I need to do other steps (in addition to sending this
> email) ?

Here you can find more information, please follow the links there:
http://www.vtk.org/Wiki/CMake:Module_Maintainers

> When will the new module file be available to cmake users?

Well, the next release is 2.8.5 in 2 or 3 months or so.

> Is there a clean way to provide the FindArmadillo.cmake file for people
> installing armadillo that are not likely to update cmake anytime soon? 

Not really. You could put it in the cmake wiki or on the armadillo website.
A good thing to do would be if armadillo would install a ArmadilloConfig.cmake 
file, which will be automatically found by find_package() even without a 
FindArmadillo.cmake

> Is hard-copying the file into cmakeroot/Modules a good strategy?

No.

> Is there an other way to dynamically add a cmake module while installing
> a new software?

No, because this doesn't make sense.
The purpose of a FindFoo.cmake is to find out whether Foo is installed or not, 
and iof installed, find out where it is installed. This means it must be 
available also when Foo itself is not installed.

> Best regards,
> Clement.


Some comments on the file:

* In order to be accepted into cmake the license of the file must be BSD or 
similar, LGPL is AFAIK not accepted.

* Please use consistent upper or lower-casing of the commands. Lower-casing is 
prefered.

* The
if(WIN32)
else()
endif()
for finding the library and headers doesn't seem to be necessary, you can just 
list all possible directories in one call to find_path() and find_library() 
respectively.

* The additional search paths given in the not-WIN32 branch shouldn't be 
necessary, these are all standard search paths.

* For checking whether it has been found successfully, please use the 
find_package_handle_standard_args() macro:
find_package_handle_standard_args(Armadillo
                        REQUIRED_VARS Armadillo_LIBRARY Armadillo_INCLUDE_DIR
                        VERSION_VAR Armadillo_VERSION_STRING)

This will handle the version comparison, the check whether it is required or 
not, QUIET and not QUIET automatically for you.

Alex



More information about the cmake-developers mailing list