[CMake] Where to put own FindXXX.cmake

Mike Jackson imikejackson at gmail.com
Wed Feb 20 11:10:19 EST 2008


This is what I do:

Inside the top level of your Project directory create a "Resources" folder.
Then in your top level CMakeLists.txt file add the following:

# Look in our Resources FIRST for FindXXX modules
SET (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Resources
${CMAKE_MODULE_PATH} )

Works for me. Not _real_ scalable depending on how many projects you
have using the same modules.

You could have your own modules directory located somewhere on your
system and then just use the above but set the path to your own
modules directory..

Mike Jackson

On Wed, Feb 20, 2008 at 10:48 AM, Olivier Tournaire <olitour at gmail.com> wrote:
> Hi all,
>
> I sometimes have to define my own Findxxx.cmake, or update the ones
> coming with the package. I leave them or put them in the Modules
> directory. However, when I want to update my CMake version, I guess the
> files in the Modules directory are deleted or replace by the ones in the
> new distribution.
>
> So, I would like to know how can I set something in CMake to give it
> another directory to search for my own Findxxx.cmake.
>
> Best regards,
>
> Olivier


More information about the CMake mailing list