[CMake] Problem writing FindTPProto.cmake

Tristan Carel tristan.carel at gmail.com
Sat Nov 25 22:57:57 EST 2006


On 11/25/06, Jure Repinc <jlp at holodeck1.com> wrote:
> Hi,
>
> I've just started working on a new project and I have decided to try
> using CMake for it. The project depends on TPProto library so I also had
> to write FindTPProto.cmake (file attached).
>
> The problem is that when I run cmake on the folder with CMakeLists.txt
> where I included the line:
> find_package( TPProto REQUIRED )
> I get this error:
> CMake Error: TPProto_DIR is not set.  It must be set to the directory
> containing TPProtoConfig.cmake in order to use TPProto.

In the documentation of the command `FIND_PACKAGE' you can read:

"Directories listed in CMAKE_MODULE_PATH are searched for files called
"Find<name>.cmake". If such a file is found, it is read and processed
by CMake, and is responsible for finding the package."

you can see the default content of the variable:
MESSAGE(STATUS "CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")

To load your own modules, you have to add the directory where your
modules are located to the variable `CMAKE_MODULE_PATH':
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/modules)

> I have also moved FindTPProto.cmake to the folder where other
> Find*.cmake files are.

The directory where all the CMake modules are located is contained in
the `CMAKE_MODULE_PATH' variable, so it's strange, CMake should be
able to find your module. maybe a permission problem???

-- 
Tristan Carel
http://tristan-carel.com
Music with dinner is an insult both to the cook and the violinist.


More information about the CMake mailing list