MantisBT - VTK
View Issue Details
0014826VTK(No Category)public2014-06-26 18:282015-02-10 09:43
Jean-Christophe Fillion-Robin 
Dave DeMarle 
normalminorhave not tried
closedfixed 
6.1.rc 
6.2.0 
TBD
incorrect functionality
0014826: VTKConfigVersion does NOT complain "appropriately" if a VTK_DIR containing a different version is passed
Using the example below, we can see that a project expecting VTK 6 can not be built against VTK 6.1:

//---------------------
cmake_minimum_required(VERSION 2.8.12)
find_package(VTK 6 REQUIRED)
//---------------------

cmake -DVTK_DIR:PATH=/path/to/VTKv6-build # Contain build of VTK 6.1

The message returned is:

// --------------------------
$ ~/Support/cmake-3.0.0/bin/cmake -DVTK_DIR:PATH=/home/jchris/Projects/VTKv6-build/ ../
-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.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
CMake Error at /home/jchris/Support/cmake-3.0.0-rc6/Modules/FindVTK.cmake:150 (message):
  VTK not found. Set the VTK_DIR cmake cache entry to the directory
  containing VTKConfig.cmake. This is either the root of the build tree, or
  PREFIX/lib/vtk for an installation.
Call Stack (most recent call first):
  CMakeLists.txt:2 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/jchris/Projects/sandbox/test-find-vtk6/build/CMakeFiles/CMakeOutput.log".
// --------------------------
hackaton
? FindVTK.cmake (1,999) 2014-06-27 10:35
https://www.vtk.org/Bug/file/9669/FindVTK.cmake
Issue History
2014-06-26 18:28Jean-Christophe Fillion-RobinNew Issue
2014-06-27 09:16Brad KingNote Added: 0032943
2014-06-27 10:17Jean-Christophe Fillion-RobinNote Added: 0032945
2014-06-27 10:35Brad KingFile Added: FindVTK.cmake
2014-06-27 10:36Brad KingNote Added: 0032946
2014-06-29 16:12Jean-Christophe Fillion-RobinNote Added: 0032953
2014-06-30 09:41Brad KingNote Added: 0032961
2014-06-30 09:45Brad KingNote Edited: 0032961bug_revision_view_page.php?bugnote_id=32961#r778
2014-06-30 09:46Jean-Christophe Fillion-RobinNote Added: 0032962
2014-07-01 08:41Brad KingNote Edited: 0032961bug_revision_view_page.php?bugnote_id=32961#r783
2014-10-01 22:14Dave DeMarleTag Attached: hackaton
2014-10-01 22:14Dave DeMarleAssigned To => Dave DeMarle
2014-10-02 14:20Dave DeMarleNote Added: 0033507
2014-10-02 14:20Dave DeMarleStatusbacklog => closed
2014-10-02 14:20Dave DeMarleResolutionopen => fixed
2015-02-07 23:39Dave DeMarleStatusclosed => backlog
2015-02-07 23:39Dave DeMarleResolutionfixed => reopened
2015-02-07 23:39Dave DeMarleNote Added: 0034193
2015-02-07 23:39Dave DeMarleStatusbacklog => gerrit review
2015-02-10 09:43Dave DeMarleStatusgerrit review => closed
2015-02-10 09:43Dave DeMarleResolutionreopened => fixed
2015-02-10 09:43Dave DeMarleFixed in Version => 6.2.0

Notes
(0032943)
Brad King   
2014-06-27 09:16   
What is the message if you change the call in your application to

 find_package(VTK 6 REQUIRED NO_MODULE)

?
(0032945)
Jean-Christophe Fillion-Robin   
2014-06-27 10:17   
It works as expected when passing the NO_MODULE parameter.

// -----------
$ cmake -DVTK_DIR:PATH=/home/jchris/Projects/Slicer-2-SuperBuild-Release/VTKv6-build/ .
CMake Error at CMakeLists.txt:2 (find_package):
  Could not find a configuration file for package "VTK" that is compatible
  with requested version "6".

  The following configuration files were considered but not accepted:

    /path/to/VTKv6-build/VTKConfig.cmake, version: 6.1.0

// -----------

May be FindVTK.cmake could use the approach applied to FindDCMTK.cmake to first look up for the no modulae version.
See https://github.com/InsightSoftwareConsortium/ITK/blob/c537467e72f8707ae5d7ddad87c4661aa7b2d7af/Modules/ThirdParty/DCMTK/CMake/FindDCMTK.cmake#L15-95 [^]
(0032946)
Brad King   
2014-06-27 10:36   
Please try replacing FindVTK.cmake in your CMake installation with the attached version. By dropping support for finding VTK 4.0 we can make it a true thin-wrapper like FindITK is.
(0032953)
Jean-Christophe Fillion-Robin   
2014-06-29 16:12   
By using the attached FindVTK.cmake and calling "find_package(VTK 6.1 REQUIRED)", I indeed get the "expected" message:

// ------------------
$ ~/Support/cmake-3.0.0/bin/cmake -DVTK_DIR:PATH=/home/jchris/Projects/Slicer-2-SuperBuild-Debug/VTKv6-build/ .
-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.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
CMake Error at /home/jchris/Support/cmake-3.0.0/Modules/FindVTK.cmake:58 (find_package):
  Could not find a configuration file for package "VTK" that is compatible
  with requested version "6".

  The following configuration files were considered but not accepted:

    /home/jchris/Projects/Slicer-2-SuperBuild-Debug/VTKv6-build/VTKConfig.cmake, version: 6.1.0

Call Stack (most recent call first):
  CMakeLists.txt:2 (find_package)


-- Configuring incomplete, errors occurred!
// ------------------
(0032961)
Brad King   
2014-06-30 09:41   
(edited on: 2014-07-01 08:41)
I've committed the simplified FindVTK to CMake here:

 FindVTK: Drop support for finding VTK 4.0
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=117e7e11 [^]

(0032962)
Jean-Christophe Fillion-Robin   
2014-06-30 09:46   
Thanks.
(0033507)
Dave DeMarle   
2014-10-02 14:20   
Fixed in cmake commit 117e7e11
(0034193)
Dave DeMarle   
2015-02-07 23:39   
http://review.source.kitware.com/#/c/19156/ [^]