versioning.cmake 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. include (ProjectVersioning)
  2. function (generate_versioning_information
  3. TARGET_NAME i_target_name
  4. EXPORT_HEADER i_export_header
  5. EXPORT_MACRO i_export_macro
  6. VERSIONED_ENTITY i_versioned_entity
  7. INCLUDE_PREFIX i_include_prefix
  8. COMPANY_NAME i_company_name
  9. COMPANY_COPYRIGHT i_company_copyright
  10. FILE_DESCRIPTION i_file_description
  11. )
  12. target_version_information (
  13. TARGET_NAME ${i_target_name}
  14. EXPORT_HEADER ${i_export_header}
  15. EXPORT_MACRO ${i_export_macro}
  16. VERSIONED_ENTITY ${i_versioned_entity}
  17. )
  18. if (WIN32)
  19. include (generate_product_version)
  20. get_target_property (gitDescribe
  21. ${i_target_name} GIT_DESCRIBE)
  22. get_target_property (gitUntracked
  23. ${i_target_name} GIT_UNTRACKED_FILES)
  24. generate_product_version (
  25. win32VersionInfoFiles
  26. NAME ${i_versioned_entity}
  27. VERSION_MAJOR ${${i_versioned_entity}_VERSION_MAJOR}
  28. VERSION_MINOR ${${i_versioned_entity}_VERSION_MINOR}
  29. VERSION_PATCH ${${i_versioned_entity}_VERSION_PATCH}
  30. COMPANY_NAME ${i_company_name}
  31. COMPANY_COPYRIGHT ${i_company_copyright}
  32. COMMENTS "${gitDescribe}${gitUntracked}"
  33. FILE_DESCRIPTION ${i_file_description}
  34. )
  35. target_sources (${i_target_name} PRIVATE ${win32VersionInfoFiles})
  36. endif (WIN32)
  37. endfunction (generate_versioning_information)