I have variable CC_OPTIONS has value set like below
-arch arm64 -mcpu=abc1 -c --debug -O2 -static -fstack-protector -ffreestanding -nostartfiles -std=c11
I wanted to extract -mcpu=abc1
from CC_OPTIONS
Tried below approach, but getting more than what i wanted.
string(REGEX REPLACE ".*mcpu=(.*) .*" "\1" CPU_TYPE "${CC_OPTIONS}")
any suggestions?
question from:https://stackoverflow.com/questions/65851799/cmake-extract-substring-from-variable