On Thursday 07 July 2011, Alexander Neundorf wrote:
> On Thursday 07 July 2011, Brad King wrote:
> > On 7/6/2011 4:00 PM, Alexander Neundorf wrote:
> > > Since that Version.cmake file in most cases looks basically the same
> >
> > They're only the same within a specific community's versioning scheme.
> > The whole reason find_package loads package-provided version check
> > files is to avoid imposing a versioning/compatibility scheme. If
> > we provide a template then we should name it after the scheme it
> > follows.
> >
> > Provide a module with macros to generate version files with different
> > common schemes. Use configure_file with CMakeConfigurableFile.in as
> > the input if you don't want a custom .in file.
>
> I'd do that, but when I first wrote that file, I was actually surprised
> that I could think of only one way to do it:
>
> if (currentVersion < requestedVersion)
> {
> compatible = false;
> }
> else
> {
> compatible = true;
> if (currentVersion == requestedVersion)
> {
> exact = true;
> }
> }
>
>
> I think everything else are special cases, at least I can't think of other
> generic cases.
> How could another common scheme look like ?
Any ideas ?
Beside that, attached is a modified version which now also fails if
SIZEOF_VOID_P of the installed version differs from the current on.
Alex
# This is a very basic file for the new style find_package() search mode,
# i.e. Config-mode.
# In this mode find_package() searches for a <package>Config.cmake
# file and an associated <package>Version.cmake file, which it loads to check
# the version number.
# This file can be used with configure_file() to generate such a file for a
project
# with very basic logic.
# It 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.
# If this is not good enough for your project, you need to write your own
# improved <package>Version.cmake file.
set(PACKAGE_VERSION @BAR_VERSION_MAJOR@.@BAR_VERSION_MINOR@.@BAR_VERSION_PATCH@)
if(NOT "@CMAKE_SIZEOF_VOID_P@" STREQUAL "${CMAKE_SIZEOF_VOID_P}")
math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
# return()
#endif()
else()
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
endif("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
endif()
_______________________________________________
cmake-developers mailing list
cmake-developers@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers