NeuralPi

Raspberry Pi guitar pedal using neural networks to emulate real amps and effects
Log | Files | Refs | Submodules | README

SubprojectVersion.cmake (919B)


      1 # subproject_version(<subproject-name> <result-variable>)
      2 #
      3 # Extract version of a sub-project, which was previously included with add_subdirectory().
      4 function(subproject_version subproject_name VERSION_VAR)
      5     # Read CMakeLists.txt for subproject and extract project() call(s) from it.
      6     file(STRINGS "${${subproject_name}_SOURCE_DIR}/CMakeLists.txt" project_calls REGEX "[ \t]*project\\(")
      7     # For every project() call try to extract its VERSION option
      8     foreach(project_call ${project_calls})
      9         string(REGEX MATCH "VERSION[ ]+([^ )]+)" version_param "${project_call}")
     10         if(version_param)
     11             set(version_value "${CMAKE_MATCH_1}")
     12         endif()
     13     endforeach()
     14     if(version_value)
     15         set(${VERSION_VAR} "${version_value}" PARENT_SCOPE)
     16     else()
     17         message("WARNING: Cannot extract version for subproject '${subproject_name}'")
     18     endif()
     19 
     20 endfunction(subproject_version)