[vtkusers] Problem depending on VTK >= 8.1 with CMake 3.12.1 and VTK 8.1.1 on Win 10/MSVC 2017
Elvis Stansvik
elvis.stansvik at orexplore.com
Sun Aug 19 06:03:14 EDT 2018
2018-08-19 10:54 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
> 2018-08-19 10:45 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
>> 2018-08-19 10:05 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
>>> Hey all,
>>>
>>> In the past it was worked for us to depend on VTK 8.1 with
>>>
>>> find_package(VTK 8.1 ....)
>>>
>>> But now I'm having trouble with a setup like this:
>>>
>>> - Windows 10
>>> - CMake 3.12.1
>>> - VTK 8.1.1
>>>
>>> The error I get when configuring our project is:
>>>
>>> -- Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.16299.
>>> CMake Error at CMakeLists.txt:29 (find_package):
>>> Could not find a configuration file for package "VTK" that is compatible
>>> with requested version "8.1".
>>>
>>> The following configuration files were considered but not accepted:
>>>
>>> C:/Users/Elvis/Dev/VTK-8.1.1-inst/lib/cmake/vtk-8.1/VTKConfig.cmake,
>>> version: 8.1.1 (64bit)
>>>
>>> This is nonsensical to me. Version 8.1.1 (which was found) should be
>>> able to satisfy 8.1.
>>
>> By digging in VTKConfigVersion.cmake I've found out that this is due
>> to some 32/64 bit mismatch (would be nice with a better error
>> message).
>>
>> I.e. this check is failing:
>>
>> # check that the installed version has the same 32/64bit-ness as the
>> one which is currently searching:
>> if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
>> math(EXPR installedBits "8 * 8")
>> set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
>> set(PACKAGE_VERSION_UNSUITABLE TRUE)
>> endif()
>
> So ${CMAKE_SIZEOF_VOID_P} is 4 on this computer (just printed it with
> message(..)), despite
>
> 1) CMake is installed from cmake-3.12.1-win64-x64.msi
> 2) The computer is 64 bit
> 3) The OS is 64 bit
> 4) It's run in a MSVC native x64 command prompt
>
> Is this a CMake bug? Or should the check above be rewritten somehow?
My mistake was simply that I did not specify a generator, and the
default (Visual Studio) generators default to the 32-bit compiler.
In the end, I was intending to use the Ninja generator, and it uses
the 64-bit compiler by default.
So all is well now.
Elvis
>
> Elvis
>
>>
>> I'll try to figure out where I went wrong, but I'm pretty sure
>> everything has been done in a MSVC 64-bit native command prompt, and
>> the machine is 64-bit.
>>
>> Elvis
>>
>>>
>>> Just to test, I set the dependency in our CMakeLists.txt to exactly
>>> 8.1.1, and got:
>>>
>>> -- Selecting Windows SDK version 10.0.17134.0 to target Windows 10.0.16299.
>>> CMake Error at CMakeLists.txt:29 (find_package):
>>> Could not find a configuration file for package "VTK" that is compatible
>>> with requested version "8.1.1".
>>>
>>> The following configuration files were considered but not accepted:
>>>
>>> C:/Users/Elvis/Dev/VTK-8.1.1-inst/lib/cmake/vtk-8.1/VTKConfig.cmake,
>>> version: 8.1.1 (64bit)
>>>
>>> Which makes it obvious something is not right.
>>>
>>> For reference, cmake was invoked like
>>>
>>> cmake -DCMAKE_PREFIX_PATH=C:/Users/Elvis/Dev/qwt-6.1.2-inst;C:/Users/Elvis/Dev/VTK-8.1.1-inst;C:/Users/Elvis/Dev/HDF5/1.10.2;C:/Users/Elvis/Dev/karchive-5.36.0-inst
>>> ..
>>>
>>> where C:/Users/Elvis/Dev/VTK-8.1.1-inst is the installation prefix of VTK.
>>>
>>> Any ideas? Was there some change in CMake recently that could have caused this?
>>>
>>> Many thanks in advance,
>>> Elvis
More information about the vtkusers
mailing list