[CMake] Finding (and linking) gettext with CMake 2.4.x

Philip Lowman philip at yhbt.com
Fri Apr 3 23:03:51 EDT 2009


On Fri, Apr 3, 2009 at 10:03 PM, Naram Qashat <cyberbotx at cyberbotx.com>wrote:

> On the project I'm working on, one of the developers expressed interest in
> utilizing gettext to handle internationalization and localization.  I found
> that CMake 2.6.0 and newer have a FindGettext.cmake module which would allow
> us to utilize gettext for this.  However, I've made our CMake build files
> able to function under CMake 2.4.x as well, due to our users compiling our
> software on shells that may not have the latest CMake, and there is no
> FindGettext.cmake with those versions.  Is it possible to include
> FindGettext.cmake in the root directory of my project and utilize that if
> CMake 2.4.x is used?


Naram,

Yes.  You can set CMAKE_MODULE_PATH conditionally based on the value of
CMAKE_MAJOR_VERSION & CMAKE_MINOR_VERSION.

If you've never used CMAKE_MODULE_PATH before I should warn you like most
CMake variables, it doesn't understand relative paths.  You must use
variables like ${PROJECT_SOURCE_DIR} or ${CMAKE_CURRENT_SOURCE_DIR}.

Also, in general if you want to backport modules from 2.6.x to 2.4.x you
have to take into account the HINTS option to find_package() and calls to
include(FindPackageHandleStandardArgs) both of which were added in 2.6.x.
It appears that the FindGetText.cmake hasn't been updated to use these yet
so using it with CMake 2.4 looks like it should be fairly easy.

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090403/0e62b8de/attachment.htm>


More information about the CMake mailing list