[CMake] error in custom Find module and use

dean.inglis at camris.ca dean.inglis at camris.ca
Wed Apr 18 10:41:48 EDT 2007


Hi,
just need a little push to get over the hump here..

I have a set of vtk custom classes built into static libs
with the cmake set up modelled after VTK/Examples/Build/vtkMy:
but called vtkLocal.
I am building a KWWidgets app that requires vtkLocal:

in my kww app CMakeLists.txt:
<snip>

FIND_PACKAGE(vtkLocal REQUIRED)
IF(VTKLOCAL_FOUND)
  INCLUDE_DIRECTORIES(
    ${VTKLOCAL_BINARY_DIR}
    ${VTKLOCAL_SOURCE_DIR}/Common
    ${VTKLOCAL_SOURCE_DIR}/Graphics
    ${VTKLOCAL_SOURCE_DIR}/Imaging
    ${VTKLOCAL_SOURCE_DIR}/Hybrid
    )
  LINK_LIBRARIES(${VTKLOCAL_LIBRARIES})
ENDIF(VTKLOCAL_FOUND)

<snip>

my find package module for vtkLocal is:

FindvtkLocal.cmake:

# - Try to find vtkLocal
# Once done this will define
#
#  VTKLOCAL_FOUND - system has vtkLocal
#  VTKLOCAL_SOURCE_DIR - the vtkLocal source directory
#  VTKLOCAL_BINARY_DIR - the vtkLocal build directory
#  VTKLOCAL_LIBRARIES - The libraries needed to use vtkLocal

FIND_PATH(VTKLOCAL_SOURCE_DIR vtkLocalConfigure.h.in 
    d:/Developer/ISSCode/vtkLocal 
    )

  SET(VTKLOCAL_NAMES ${VTKLOCAL_NAMES} vtkLocal)
  FIND_LIBRARY(VTKLOCAL_LIBRARY
    NAMES ${VTKLOCAL_NAMES}
    PATHS d:/Developer/Releases/VS/vtkLocalStatic/bin
    ) 

  IF (VTKLOCAL_LIBRARY AND VTKLOCAL_SOURCE_DIR)
    SET(VTKLOCAL_LIBRARIES ${VTKLOCAL_LIBRARY})
    SET(VTKLOCAL_FOUND TRUE)
  ENDIF (VTKLOCAL_LIBRARY AND VTKLOCAL_SOURCE_DIR)


IF (VTKLOCAL_FOUND)
   IF (NOT vtkLocal_FIND_QUIETLY)
      MESSAGE(STATUS "Found vtkLocal: ${VTKLOCAL_LIBRARIES}")
   ENDIF (NOT vtkLocal_FIND_QUIETLY)
ELSE (VTKLOCAL_FOUND)
   IF (vtkLocal_FIND_REQUIRED)
      MESSAGE(FATAL_ERROR "Could not find vtkLocal")
   ENDIF (vtkLocal_FIND_REQUIRED)
ENDIF (VTKLOCAL_FOUND)


When I run cmake (2.4) I get a cmake error:
vtkLocal_DIR is not set.  It must be set to the directory containing
vtkLocalConfig.cmake in order to use vtkLocal.

What I want is the path to the vtkLocal source, the path to the
build where the .h configure file is, and the path to the libs.

Dean


More information about the CMake mailing list