[CMake] find_package with ###Config.cmake

Micha Renner Micha.Renner at t-online.de
Fri Dec 3 09:19:38 EST 2010


> Meanwhile, with 2.8.3 to be exact, the warning message issued by CMake
> if a version file is found but the requested version doesn't suit is:
> 
> Could not find a configuration file for package "..." that is compatible
> with requested version "...".
> 
> The following configuration files were considered but not accepted:
> 
>   ..., version: ...
> 
> So, Micha, which CMake version do you use? If it's not 2.8.3 could you
> give that a try and report the message if the problem still persists?
> Additionally, the <package>_CONSIDERED_{CONFIGS,VERSIONS} variables
> would be of special interest, see dfe9c95.
> 
On Linux, I use 2.8.0, what to be is the problem. 

So I switched to a Windows machine, which has 2.8.3. The warning I
mentioned above disappeared.

But a call of 
FIND_PACKAGE(TLIB 1.3)
results in this message:
------------------------
CMake Error at TestDLL/CMakeLists.txt:19 (FIND_PACKAGE):
Could not find a configuration file for package "TLIB" that is
compatible
with requested version "1.3".
  
The following configuration files were considered but not accepted:
  
C:/usr/local/lib/TLib/TLIBConfig.cmake, version: 1.3
  
 
-- TLIB_CONSIDERED_VERSIONS: 1.3
-- TLIB_CONSIDERED_CONFIGS: C:/usr/local/lib/TLib/TLIBConfig.cmake
------------------------
Since my knowledge is based on "CMake 2.6 Notes", there are some more
questions.

The ###ConfigVersion.cmake is still necessary?

If so, ###ConfigVersion.cmake should have at least the following
content?
------------------------
SET(PACKAGE_NAME "TLib")
SET(PACKAGE_VERSION 1.3)
IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
	SET(PACKAGE_VERSION_COMPATIBLE 1)
	IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 3)
		SET(PACKAGE_VERSION_EXACT 1)# exact match for version 1.3
	ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 3)
ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
------------------------

Greetings

Micha






More information about the CMake mailing list