[CMake] contribution: FindMySQL.cmake
Michael Wild
themiwi at gmail.com
Tue Jul 6 16:16:25 EDT 2010
On 6. Jul, 2010, at 21:01 , Arnaud GELAS wrote:
> Hi guys,
>
> We have been for our own projects the following file to find mysql packages, and I would like to contribute it to the community.
>
> Note: it works fine for MySQL 5.1 on Windows (tested on XP and 7), Mac (tested on 10.5 and 10.6) and Linux.
> I guess it could be improved for other version of MySQL (older one, or beta ones), I would be happy to help in the improvement of this file.
>
> Thanks,
> Best Regards,
>
> Arnaud
> <FindMySQL.cmake>
Hi
A few things that could be improved:
- Use the formatting conventions for the header-comment (e.g. start brief description with "# - ")
- Use standard variable names:
* Use MYSQL_INCLUDE_DIR for the find_path call
* Use MYSQL_LIBRARY for the find_library call
* List all required include directories in MYSQL_INCLUDE_DIRS, do not cache the variable
* List all required libraries in MYSQL_LIBRARIES, do not cache
* The MYSQL_EXTRA_LIBRARIES variable is ugly, try to get rid of it by really detecting what the dependencies are
- Use FindZLIB to find the zlib library
- Use the FindPackageHandleStandardArgs module to simplify your module
- /usr and /usr/local are used by default as search prefixes
- Also on Windows "C:\Program Files" and "C:\Program Files (x86)" are used as search prefixes
- Use PATH_SUFFIXES to simplify the find_xxx calls
Michael
More information about the CMake
mailing list