(cmake 3.18.2) Visual Studio project files not updated when a `find_package` call is asked for a newer version of the component
Consider the following example:
cmake_minimum_required()
project (test)
find_package(Qt5 5.13.0 EXACT REQUIRED Core)
add_library(test STATIC lib.cpp)
target_link_libraries(test Qt5::Core)
When used with the VS2017 generator (I am unable to test other versions of VS), it produces a vcxproj with the path to Qt5.13 includes, as expected.
Now, update the Qt version to 5.15 (or whatever):
+find_package(Qt5 5.15.0 EXACT REQUIRED Core)
-find_package(Qt5 5.13.0 EXACT REQUIRED Core)
and ask for a rebuild. Visual Studio successfully calls cmake
, the solution reloads and I have no error. Howerver, the vcxproj is not updated with the new include paths to Qt5.15. In order to achieve this, I have to run cmake from a fresh bin directory.
If I ask for a version of Qt that is not available, cmake fails as expected with the appropriate error message.
This behavior was observed with cmake 3.17.3 and I have just reproduced it with 3.18.2.
In case it helps, here is the lib.cpp
file used for the test:
#include <QString>
QString f()
{
return QString("test");
}
Is it the intended behavior? If so, is there a way I can force an error to occur so that the fact that the version update failed does not go unnoticed?
Regards