diff --git a/CMakeLists.txt b/CMakeLists.txt index 810e5629..fd9cb392 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,16 +192,15 @@ configure_file ( ${PROJECT_BINARY_DIR}/opm-core-config.cmake @ONLY ) +configure_file ( + ${PROJECT_SOURCE_DIR}/opm-core-config-version.cmake.in + ${PROJECT_BINARY_DIR}/opm-core-config-version.cmake + @ONLY + ) configure_vars ( FILE CMAKE "${PROJECT_BINARY_DIR}/opm-core-config.cmake" APPEND "${opm-core_CONFIG_VARS}" ) -include (WriteBasicConfigVersionFile) -write_basic_config_version_file ( - "${PROJECT_BINARY_DIR}/opm-core-config-version.cmake" - VERSION ${opm-core_VERSION} - COMPATIBILITY SameMajorVersion - ) ### installation ### string (LENGTH ${PROJECT_SOURCE_DIR} _prefix_length) diff --git a/opm-core-config-version.cmake.in b/opm-core-config-version.cmake.in new file mode 100644 index 00000000..3904d12d --- /dev/null +++ b/opm-core-config-version.cmake.in @@ -0,0 +1,28 @@ +# - CMake version file for OPM-core +# +# Determine if requested version matches exactly or is compatible with +# the installed package. It sets the following variables: +# +# PACKAGE_VERSION Full provided version string +# PACKAGE_VERSION_COMPATIBLE True if version is compatible +# PACKAGE_VERSION_EXACT True if version is exact match + +# This file is used by find_package to see if the installed version of a +# package can be used by the client, before the main -config.cmake file +# is loaded. +# see + +# this is the version that is installed +set (PACKAGE_VERSION @opm-core_VERSION@) + +# if we wanted this exact version, then everything's fine +if (PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION) + set (PACKAGE_VERSION_EXACT TRUE) +endif (PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION) + +# in general, we assume that there is going to be API breakage between +# released versions; this will hopefully change in the future +## compatible versions +#if (NOT PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) +# set (PACKAGE_VERSION_COMPATIBLE TRUE) +#endif (NOT PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)