[CMake] custom cmake files

Michael G. Hansen mikeml2 at pfna.de
Fri Aug 3 17:20:15 EDT 2007


Marie-Christine Vallet wrote:
> Michael G. Hansen wrote:
>> Marie-Christine Vallet wrote:
>>> I wanted to check for an non standard existing library (QGLViewer) 
>>> and found a custom .cmake file  on Internet that will do that for me. 
>>> The problem is that I am starting cmake, and do not know where to 
>>> place that custom .cmake file
>>> I found the custom .cmake file here: 
>>> http://www-id.imag.fr/FLOWVR/manual/flowvr-suite-src/flowvr/cmake/FindQGLViewer.cmake 
> I still have a question, if I want to check if the paths exist, the only 
> way to call this custom.cmake is to add  MACRO(MACRO_FINDQGLVIEWER) and
> ENDMACRO(MACRO_FINDQGLVIEWER) in the script than to call this macro am I 
> correct ? or is there a simpler way?

If I understand you correctly, you want to check whether the 
FindQGLViewer found what it was looking for?

There should be no need to turn the file into a macro. Once you do

# Additional CMake modules for 3rd party library checks reside here
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_admin")
FIND_PACKAGE(QGLViewer)

which executes the code in FindQGLViewer.cmake, you can do stuff like:

IF(QGLVIEWER_FOUND)
   MESSAGE(STATUS "QGLViewer found")
   ...
ENDIF(QGLVIEWER_FOUND)

in your CMakeLists file and use the variables set by the 
FindQGLViewer.cmake.

HTH, Mike


-- 
Michael Hansen - http://www.pfna.de/
Monheim / Germany


More information about the CMake mailing list