When I specify the find package version as 3.3 for assimp in cmake, it complain that a compatible version of the library can not be found. The exact line is:
CMake Error at CMakeLists.txt:6 (find_package):
Could not find a configuration file for package "assimp" that is compatible
with requested version "3.3".
The following configuration files were considered but not accepted:
C:/Development/Libraries/lib64/cmake/assimp-3.3/assimp-config.cmake, version: 3.3.1
It seems that there is a check for exact required version (which include patch number), i.e. 3.3.1. A check for compatible version, where the required version must be < 3.3 (but does not include version 3.3). However there is no check for just the current Major.Minover version, i.e. version 3.3.
On line 9 of the assimp-config-version.cmake.in file there is a check that reads:
if( ${PACKAGE_FIND_VERSION_MINOR} LESS @ASSIMP_VERSION_MINOR@ )
Without any other checks, this does not allow for the case where only the major and minor version is specified. (It seems rare that someone will also specify a patch version unless a very specific bug has been fixed.) I believe the line should be changed to:
if( ${PACKAGE_FIND_VERSION_MINOR} EQUAL @ASSIMP_VERSION_MINOR@ OR ${PACKAGE_FIND_VERSION_MINOR} LESS @ASSIMP_VERSION_MINOR@ )
This result in compatibility checks where minimum compatible required version is <= 3.3 instead of < 3.3. With this change, when a user specify 3.3.1 for the version, then PACKAGE_VERSION_EXACT is set to 1. If the user specify the version 3.3, then the PACKAGE_VERSION_COMPATIBLE is set to 1. (With this modification cmake is able to find assimp 3.3 and the program compile and run.)
I believe the modded version of line 9 is how it should behave?
Cheers
-Vinnie
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This seems like it should be populated with 3.3 which should also resolve the issue as decribed above. It is however just populated with 3. Tracing the ASSIMP_SOVERSION variable back to the main CMakeLists.txt file, you can see it being set on line 52 with:
SET (ASSIMP_SOVERSION 3)
I'm guessing that this should perhaps be:
SET (ASSIMP_SOVERSION 3.3)
or a more automatic version:
SET (ASSIMP_SOVERSION "${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}")
This also fixes the issue for me with correctly identifying compatible assimp versions.
Based on the cmake documentation regarding SOVERSION it seems like what was intended from the start:
For shared libraries and executables on Windows the VERSION attribute is parsed to extract a “major.minor” version number.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Guys
When I specify the find package version as 3.3 for assimp in cmake, it complain that a compatible version of the library can not be found. The exact line is:
find_package(assimp 3.3 CONFIG REQUIRED PATH_SUFFIXES "/cmake/assimp-3.3")
The cmake output is:
It seems that there is a check for exact required version (which include patch number), i.e. 3.3.1. A check for compatible version, where the required version must be < 3.3 (but does not include version 3.3). However there is no check for just the current Major.Minover version, i.e. version 3.3.
On line 9 of the assimp-config-version.cmake.in file there is a check that reads:
if( ${PACKAGE_FIND_VERSION_MINOR} LESS @ASSIMP_VERSION_MINOR@ )
Without any other checks, this does not allow for the case where only the major and minor version is specified. (It seems rare that someone will also specify a patch version unless a very specific bug has been fixed.) I believe the line should be changed to:
if( ${PACKAGE_FIND_VERSION_MINOR} EQUAL @ASSIMP_VERSION_MINOR@ OR ${PACKAGE_FIND_VERSION_MINOR} LESS @ASSIMP_VERSION_MINOR@ )
This result in compatibility checks where minimum compatible required version is <= 3.3 instead of < 3.3. With this change, when a user specify 3.3.1 for the version, then
PACKAGE_VERSION_EXACT
is set to1
. If the user specify the version 3.3, then thePACKAGE_VERSION_COMPATIBLE
is set to1
. (With this modification cmake is able to find assimp 3.3 and the program compile and run.)I believe the modded version of line 9 is how it should behave?
Cheers
-Vinnie
I've noticed there is actually a check on line
5
ofassimp-config-version.cmake.in
that reads:This seems like it should be populated with
3.3
which should also resolve the issue as decribed above. It is however just populated with3
. Tracing theASSIMP_SOVERSION
variable back to the mainCMakeLists.txt
file, you can see it being set on line 52 with:I'm guessing that this should perhaps be:
or a more automatic version:
This also fixes the issue for me with correctly identifying compatible assimp versions.
Based on the cmake documentation regarding
SOVERSION
it seems like what was intended from the start:Thank you very much for figuring this out! The bug should be fixed on the latest master now.
Kimmi
no worries. :)