[CMake] Find package with version numbers
Tim Gallagher
tim.gallagher at gatech.edu
Wed Dec 14 18:33:11 EST 2011
Boost takes arguments for versions of the library if you need a concrete example.
Tim
----- Original Message -----
From: "Alexander Neundorf" <a.neundorf-work at gmx.net>
To: cmake at cmake.org
Sent: Wednesday, December 14, 2011 5:11:45 PM
Subject: Re: [CMake] Find package with version numbers
On Wednesday 14 December 2011, Robert Dailey wrote:
> Is there any example of how to write a find module for find_package() that
> utilizes version numbers? How is the version number passed into the
> Find*.cmake module? The documentation on this is very confusing and
> discusses creating a version.cmake file. I looked in the CMake modules
> directory for an example but there are no version files...
>
> I'm creating a find module for the Microsoft Platform SDK:
> FindMSPlatformSDK.cmake. I need to be able to call it like so:
>
> find_package( MSPlatformSDK 7.0 )
See the readme file in the cmake modules directory.
In the Find-module, you have access to
<name_of_the_package>_FIND_VERSION_(MAJOR|MINOR|PATCH) etc. variables which
you can check.
If you determine the version of the found package, you can then simply put the
found version number into a variable, and use the new-style
find_package_handle_standard_args(... VERSION_VAR ...) macro to evaluate it,
it will fail if it is not good.
For creating a FooConfigVersion.cmake file (when installing your own library),
you may use the WriteBasicConfigVersionFile.cmake (since cmake 2.8.6) which
writes a basic version file for you, which you can install along with your
library.
Alex
--
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
More information about the CMake
mailing list