xmos / xcommon_cmake

6 stars 5 forks source link

Add a way to query the XCommon CMake version #163

Closed danielpieczko closed 5 months ago

danielpieczko commented 5 months ago

Two use-cases:

  1. A way for users to know which version they are using - this could be a variable in the cache file
  2. Allows conditional CMake code to be written, eg. a workaround is required before a particular XCommon CMake version

The CMake if command has options to do version comparison of strings, instead of lexical. Then use-case 2 could look like:

if(XCOMMON_CMAKE_VER VERSION_GREATER_EQUAL 1.1.0)
    # do something using supported feature
else()
    # do workaround as feature wasn't implemented
endif()