[Feature]: CMake install : generate a version file

Open Beginner friendly
#343 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
c, cmake

Research direction

Start in Source/CMakeLists.txt at the CMSISDSP_INSTALL block and inspect how the project version is defined. Determine the appropriate compatibility policy, generate and install the package version file alongside CMSISDSPConfig.cmake, and verify that an installed CMSIS package can be discovered by CMake with version information.

Written by the indexing model from the issue text.

Description

DONE enhancement

Hello, it is quite useful to be able to install CMSIS directly with CMake ! Thank you for adding installation support.

One improvement I can suggest is to generate a CMake version file. Something akin to :

--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -115,7 +115,16 @@ if (CMSISDSP_INSTALL)
     "${CMAKE_CURRENT_BINARY_DIR}/CMSISDSPConfig.cmake"
     INSTALL_DESTINATION ${CMSISDSP_INSTALL_CMAKEDIR})
 
-  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CMSISDSPConfig.cmake"
+  # generate version file
+  write_basic_package_version_file(
+      "${CMAKE_CURRENT_BINARY_DIR}/CMSISDSPConfigVersion.cmake"
+      VERSION "1.17.1"
+      COMPATIBILITY SameMinorVersion
+  )
+
+  install(FILES
+    "${CMAKE_CURRENT_BINARY_DIR}/CMSISDSPConfig.cmake"
+    "${CMAKE_CURRENT_BINARY_DIR}/CMSISDSPConfigVersion.cmake"
     DESTINATION ${CMSISDSP_INSTALL_CMAKEDIR})
 
   install(EXPORT CMSISDSPTargets

Replacing the hardcoded "1.17.1" with an appropriate macro, and 'SameMinorVersion' with the relevant compatibility policy of the project...

Dominant language
C
Stars
1.1k
Forks
244
Avg merge
1m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ARM-software/CMSIS-DSP

All issues in ARM-software/CMSIS-DSP

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.