[vtk-developers] Repeated calls to find_package(VTK COMPONENTS ...)

Marcus D. Hanwell marcus.hanwell at kitware.com
Tue Sep 9 13:53:14 EDT 2014


Adding you both to CC in case you aren't subscribed, it might also be
worth appending NO_MODULE to the calls to ensure find modules aren't
used, i.e. find_package(VTK COMPONENTS vtkChartsCore NO_MODULE). The
wiki page at http://www.vtk.org/Wiki/VTK/Build_System_Migration#Finding_and_Linking_to_VTK
contains advice I added, but didn't specifically cover multiple calls.
Including the use file, or setting the DIRECTORY property will of
course cause issues if you are not using separate directory scopes for
each target.

On Tue, Sep 9, 2014 at 1:23 PM, Marcus D. Hanwell
<marcus.hanwell at kitware.com> wrote:
> Hi,
>
> Moving this discussion from
> http://review.source.kitware.com/#/c/16703/ to the mailing list. As I
> was saying I do not see precisely what you see, the repeated calls
> seem to work for me locally. I would not expect the call without
> COMPONENTS to work, and am not sure we should support calling with and
> without COMPONENTS.
>
> I have a minimal CMake script,
>
> cmake_minimum_required(VERSION 3.0)
>
> find_package(VTK COMPONENTS vtkChartsCore)
> message(STATUS "LIBS: ${VTK_LIBRARIES}")
>
> find_package(VTK COMPONENTS vtkCommonCore)
> message(STATUS "LIBS: ${VTK_LIBRARIES}")
>
> find_package(VTK COMPONENTS vtkCommonMath)
> message(STATUS "LIBS: ${VTK_LIBRARIES}")
>
> find_package(VTK COMPONENTS vtkChartsCore)
> message(STATUS "LIBS: ${VTK_LIBRARIES}")
>
> find_package(VTK)
> message(STATUS "LIBS: ${VTK_LIBRARIES}")
>
> This results in the output,
>
> $ cmake -DVTK_DIR:PATH=/home/marcus/build/VTK .
> -- The C compiler identification is GNU 4.9.1
> -- The CXX compiler identification is GNU 4.9.1
> -- Check for working C compiler: /usr/bin/cc
> -- Check for working C compiler: /usr/bin/cc -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working CXX compiler: /usr/bin/c++
> -- Check for working CXX compiler: /usr/bin/c++ -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- LIBS: vtkChartsCore;vtkCommonColor;vtkCommonDataModel;vtkCommonMath;vtkCommonCore;vtksys;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkInfovisCore;vtkFiltersExtraction;vtkCommonExecutionModel;vtkFiltersCore;vtkFiltersGeneral;vtkCommonComputationalGeometry;vtkFiltersStatistics;vtkImagingFourier;vtkImagingCore;vtkalglib;vtkRenderingContext2D;vtkRenderingCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingFreeType;vtkfreetype;vtkzlib;vtkftgl
> -- LIBS: vtkCommonCore;vtksys
> -- LIBS: vtkCommonMath;vtkCommonCore;vtksys
> -- LIBS: vtkChartsCore;vtkCommonColor;vtkCommonDataModel;vtkCommonMath;vtkCommonCore;vtksys;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkInfovisCore;vtkFiltersExtraction;vtkCommonExecutionModel;vtkFiltersCore;vtkFiltersGeneral;vtkCommonComputationalGeometry;vtkFiltersStatistics;vtkImagingFourier;vtkImagingCore;vtkalglib;vtkRenderingContext2D;vtkRenderingCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingFreeType;vtkfreetype;vtkzlib;vtkftgl
> -- LIBS: vtkChartsCore;vtkCommonColor;vtkCommonDataModel;vtkCommonMath;vtkCommonCore;vtksys;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkInfovisCore;vtkFiltersExtraction;vtkCommonExecutionModel;vtkFiltersCore;vtkFiltersGeneral;vtkCommonComputationalGeometry;vtkFiltersStatistics;vtkImagingFourier;vtkImagingCore;vtkalglib;vtkRenderingContext2D;vtkRenderingCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingFreeType;vtkfreetype;vtkzlib;vtkftgl
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/marcus/build/vtkcomponents
>
> As far as I can see this gives the libraries one would expect, i.e.
> vtkChartsCore, vtkCommonCore, vtkCommonMath, vtkChartsCore, and the
> final one is incorrect but I am not sure of the value in supporting
> mixed COMPONENTS and non-components versions of find_package.
>
> Let me know if there is something I am missing, is this possibly with
> an older version of VTK (I am testing with master).
>
> Marcus



More information about the vtk-developers mailing list