| 126 | } |
| 127 | |
| 128 | func (t *targetConfig) isValidVersionFormat(version string) bool { |
| 129 | // Match patterns: |
| 130 | // 1. ^\d+(\.\d+)*$ -- number version (1, 1.2, 1.2.3, 1.2.3.4) |
| 131 | // 2. ^\d+(\.\d+)*[-+][a-zA-Z0-9._]+$ -- number version with suffix (1.0.0-alpha1, 2.0+beta) |
| 132 | pattern := `^(\d+(\.\d+)*)([-+][a-zA-Z0-9._]+)?$` |
| 133 | matched, _ := regexp.MatchString(pattern, version) |
| 134 | return matched |
| 135 | } |
| 136 | |
| 137 | // ReadCMakeConfig Find matched cmake config. |
| 138 | func ReadCMakeConfig(configPath, systemName string) (*targetConfig, error) { |