Ensure Catch2ConfigVersion.cmake is installed properly

The old version would lead to error when Catch was installed
as a subproject. The file would be written to the subproject's
build directory and then would not be installed properly.
This commit is contained in:
Bastian Dörig 2018-02-09 10:50:14 +01:00 committed by Martin Hořeňovský
parent dc8a8e6371
commit d38f782995

View File

@ -445,9 +445,10 @@ install(EXPORT Catch2Config
# install Catch2ConfigVersion.cmake file to handle versions in find_package # install Catch2ConfigVersion.cmake file to handle versions in find_package
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
write_basic_package_version_file(Catch2ConfigVersion.cmake write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
COMPATIBILITY SameMajorVersion) COMPATIBILITY SameMajorVersion)
install(FILES install(FILES
"${CMAKE_BINARY_DIR}/Catch2ConfigVersion.cmake" "${CMAKE_CURRENT_BINARY_DIR}/Catch2ConfigVersion.cmake"
DESTINATION ${CATCH_CMAKE_CONFIG_DESTINATION}) DESTINATION ${CATCH_CMAKE_CONFIG_DESTINATION})