[vtk-developers] VTK redefines the CMake macro CHECK_CXX_SOURCE_RUNS

Pat Marion pat.marion at kitware.com
Wed Apr 10 22:03:40 EDT 2013


I searched but couldn't find a previous discussion on this.  VTK redefines
the standard CMake macro CHECK_CXX_SOURCE_RUNS with an inconsistent
argument list.  If a project includes UseVTK.cmake, then VTK's version of
the macro can be injected into the project.


VTK has the file CMake/CheckCXXSourceRuns.cmake which defines the macro:

MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR COMMENT)


CMake ships with the same module, but the macro is defined as:

macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)


If a project includes UseVTK.cmake, then CMAKE_MODULE_PATH is appended to
include the directory with VTK's version of CheckCXXSourceRuns.cmake.


So if you have this code in your project:

include(CheckCXXSourceRuns)
check_cxx_source_runs(${src} RESULT)

Then you may have an error, depending on whether or not you have included
UseVTK.cmake.  The error message won't tell you where the macro was
defined, only that you called it with the wrong number of arguments:

  CHECK_CXX_SOURCE_RUNS Macro invoked with incorrect arguments for macro
  named: CHECK_CXX_SOURCE_RUNS


Pat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20130411/7e5f55d7/attachment.html>


More information about the vtk-developers mailing list