[Cmake] Re:FIND_PACKAGE?

Nils H. Busch nilsb at cns.mpg.de
Fri Mar 7 06:09:20 EST 2003


Hi,

from your explanation, I expected FIND_PACKAGE to search for a
FindFOO.cmake in the given paths (btw, is CMAKE_MODULE_PATH set by cmake
?).
However, in my little test case, this does not happen. Cmake expects the
second case you mentioned and asks for a FOO_DIR and a FOOConfig.cmake
and reports an error if it is not specified in the cmake build process.
I have attached my little CMakeLists.txt for the top-level dir and the
FindFOO.cmake.
Obviously, I haven't understood the mechanisms of FIND_PACKAGE
correctly. Maybe you could clarify this for me.

Ultimately, I want to include a project that is not cmake aware. This
project exports its build parameters in a Makefile stub file. I would
like to convert that to a Cmake conforming build file. The problem is
that there are multiple stub files for multiple builds in multiple sub
dirs and I need to find a way to pick the right one for the cmake build
of the project including this project. For each architecture and
compiler, there is a stub file in a sub-dir, but the compiler flags and
library names then depend upon certain compilation options during build
such as template preinstantiation, optimized build etc. So I cannot
manually provide config.cmake files for them. There seems to be
everything in place in cmake to handle this, but I haven't quite figured
how to use it. Mmmh ;-)

Thanks.

# FindFoo.cmake
SET(FOO_INCLUDE_DIR ${A_CMAKE_TEST_SRC_DIR}/foo)



# Top-Level CMakeLists.txt
CMAKE_MINIMUM_REQUIRED(VERSION 1.6)

PROJECT(A_CMAKE_TEST)

SET(CMAKE_MODULE_PATH ${A_CMAKE_TEST_SOURCE_DIR}/modules)
MESSAGE("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")

FIND_PACKAGE(FOO)

IF(FOO_INCLUDE_DIR)
  INCLUDE_DIRECTORIES(foo)
  MESSAGE("FOO_INCLUDE_DIR: ${FOO_INCLUDE_DIR}")
ENDIF(FOO_INCLUDE_DIR)

ADD_EXECUTABLE(bar bar.cxx)


--
    Nils H. Busch
    Max-Planck-Institute of Cognitive Neuroscience
    phone:  ++49 (341) 9940-035 fax:  ++49 (341) 9940-204
    e-mail: nilsb at cns.mpg.de






More information about the CMake mailing list