How do I specify VTK minimum version?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I specify VTK minimum version?

Victor Lamoine

Hi,

I am using CMake to set up a VTK project. Our project requires VTK to be version 7.1 or newer.
I'm using Ubuntu 16.04 with CMake 3.5.1.

My CMakeLists.txt looks like this:

cmake_minimum_required(VERSION 2.8)
project(test_vtk_versions)

find_package(VTK 7.1 REQUIRED)
include(${VTK_USE_FILE})

add_executable(test_vtk_1 test_vtk_1)
target_link_libraries(test_vtk_1 ${VTK_LIBRARIES})

I have several versions of VTK installed on my machine:

  • VTK 6.2 from the Ubuntu repositories
  • VTK 7.1 compiled/installed from sources
  • VTK 8.0 compiled/installed from sources

$ ls /usr/local/lib/cmake/vtk* /usr/lib/cmake/vtk*
/usr/lib/cmake/vtk-6.2:
exportheader.cmake.in       UseVTK.cmake                   vtkJavaWrapping.cmake       vtkModuleMacros.cmake        VTKTargets.cmake                 vtkThirdParty.cmake     vtkWrapPython.sip.in
(... list was
manually shortened ...)

/usr/local/lib/cmake/vtk-7.1:
FindTCL.cmake          VTKConfigVersion.cmake         vtkGroups.cmake             vtkModuleHeaders.cmake.in    vtkObjectFactory.h.in     vtkTclWrapping.cmake    vtkWrapPython.cmake
(... list was manually shortened ...)

/usr/local/lib/cmake/vtk-8.0:
FindTCL.cmake          VTKConfigVersion.cmake         vtkGroups.cmake             vtkModuleHeaders.cmake.in    vtkObjectFactory.h.in                          vtkTclTkMacros.cmake    vtkWrapping.cmake
(... list was manually shortened ...)

The project can be configured (Unix Makefile) and compiled, it is compiled against VTK 7.1 in this configuration.
However if I remove VTK 7.1 from the system (using sudo xargs rm < "install_manifest.txt") then I end with this this error:

CMake Error at CMakeLists.txt:4 (find_package):
  Could not find a configuration file for package "VTK" that is compatible
  with requested version "7.1".

  The following configuration files were considered but not accepted:

    /usr/local/lib/cmake/vtk-8.0/VTKConfig.cmake, version: 8.0.0
    /usr/lib/cmake/vtk-6.2/VTKConfig.cmake, version: 6.2.0

I have also tried find_package(VTK 7.1.0 REQUIRED), without success.

Why isn't VTK 8.0.0 accepted? It is a greater version number so I expected it to be ok.
How do I specify that I want VTK 7.1 OR newer?

Thank you for your time
Bye


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: How do I specify VTK minimum version?

Victor Lamoine
Hello,

I am still stuck with this problem, I don't understand what's wrong.

Is my question unclear?
Do I not provide enough information?

Please ask for additional information if I forgot something.

Bye

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: How do I specify VTK minimum version?

Rolf Eike Beer
In reply to this post by Victor Lamoine
Am Dienstag, 11. Juli 2017, 15:18:11 schrieb Victor Lamoine:
> Hi,
>
> I am using CMake to set up a VTK project. Our project requires VTK to be
> version 7.1 or newer. I'm using Ubuntu 16.04 with CMake 3.5.1.
>

> find_package(VTK 7.1 REQUIRED)
[…]
>   The following configuration files were considered but not accepted:
>
>     /usr/local/lib/cmake/vtk-8.0/VTKConfig.cmake, version: 8.0.0
>     /usr/lib/cmake/vtk-6.2/VTKConfig.cmake, version: 6.2.0
>
> I have also tried find_package(VTK 7.1*.0* REQUIRED), without success.
>
> Why isn't VTK 8.0.0 accepted? It is a greater version number so I expected
> it to be ok. How do I specify that I want VTK 7.1 OR newer?

It could be that VTK sets in it's config file "same major version"
compatibility.

Eike
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How do I specify VTK minimum version?

Elvis Stansvik
2017-07-24 12:23 GMT+02:00 Rolf Eike Beer <[hidden email]>:

> Am Dienstag, 11. Juli 2017, 15:18:11 schrieb Victor Lamoine:
>> Hi,
>>
>> I am using CMake to set up a VTK project. Our project requires VTK to be
>> version 7.1 or newer. I'm using Ubuntu 16.04 with CMake 3.5.1.
>>
>
>> find_package(VTK 7.1 REQUIRED)
> […]
>>   The following configuration files were considered but not accepted:
>>
>>     /usr/local/lib/cmake/vtk-8.0/VTKConfig.cmake, version: 8.0.0
>>     /usr/lib/cmake/vtk-6.2/VTKConfig.cmake, version: 6.2.0
>>
>> I have also tried find_package(VTK 7.1*.0* REQUIRED), without success.
>>
>> Why isn't VTK 8.0.0 accepted? It is a greater version number so I expected
>> it to be ok. How do I specify that I want VTK 7.1 OR newer?
>
> It could be that VTK sets in it's config file "same major version"
> compatibility.

Indeed. This comment from VTKConfigVersion.cmake explains it:

# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
# but only if the requested major version is the same as the current one.

Elvis

>
> Eike
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: How do I specify VTK minimum version?

Victor Lamoine
Thank you for the answers.

I used this script to fix my problem:

find_package(VTK 7.1.0 QUIET)
if (NOT VTK_FOUND)
  find_package(VTK 8.0.0 REQUIRED)
endif()
include(${VTK_USE_FILE})

Of course this will only work until there is a VTK 9.x.x version.

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: How do I specify VTK minimum version?

CMake mailing list
You don't have to ask for a specific version. You can just do:

    find_package(VTK REQUIRED)

if you don't really care what version is found.

Or if you need >= 7, you can do it like that and then check what
version was actually found, and error out yourself if it is too old.


HTH,
David C.



On Mon, Jul 24, 2017 at 10:52 AM, Victor Lamoine
<[hidden email]> wrote:

> Thank you for the answers.
>
> I used this script to fix my problem:
>
> find_package(VTK 7.1.0 QUIET)
> if (NOT VTK_FOUND)
>   find_package(VTK 8.0.0 REQUIRED)
> endif()
> include(${VTK_USE_FILE})
>
> Of course this will only work until there is a VTK 9.x.x version.
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake