File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -352,12 +352,24 @@ if (FLATCC_INSTALL)
352352 install (DIRECTORY include /flatcc DESTINATION include )
353353 install (EXPORT flatcc_exports NAMESPACE flatcc:: DESTINATION ${lib_dir} /cmake/flatcc FILE flatcc-targets.cmake)
354354
355+ file (READ include /flatcc/flatcc_version.h FLATCC_VERSION_H_CONTENT)
356+ string (REGEX MATCH "#[ \t ]*define[ \t ]+FLATCC_VERSION_TEXT[ \t ]+\" ([^\" ]+)\" " version_match "${FLATCC_VERSION_H_CONTENT} " )
357+ if (NOT version_match)
358+ message (FATAL_ERROR "Could not parse the version from include/flatcc/flatcc_version.h" )
359+ endif ()
360+ set (FLATCC_VERSION "${CMAKE_MATCH_1} " )
361+ message (VERBOSE "Extracted version from include/flatcc/flatcc_version.h: ${FLATCC_VERSION} " )
362+
355363 include (CMakePackageConfigHelpers)
356364 configure_package_config_file(cmake/flatcc-config.cmake.in flatcc-config.cmake
357365 INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR} /cmake/flatcc" )
366+ write_basic_package_version_file(flatcc-config-version .cmake
367+ VERSION "${FLATCC_VERSION} "
368+ COMPATIBILITY AnyNewerVersion)
358369 install (
359370 FILES
360371 "${CMAKE_CURRENT_BINARY_DIR} /flatcc-config.cmake"
372+ "${CMAKE_CURRENT_BINARY_DIR} /flatcc-config-version.cmake"
361373 cmake/FlatccGenerateSources.cmake
362374 DESTINATION "lib/cmake/flatcc" )
363375endif ()
You can’t perform that action at this time.
0 commit comments