Cartesius00
Cartesius00

Reputation: 24404

CMAKE string options

How to specify string option in CMakeLists.txt? Syntax option(OPT1 "Helpstring" ON) works perfectly for boolean options but I would like to have few string options like -march= argument passed to gcc.

Upvotes: 48

Views: 36176

Answers (1)

Jan Hudec
Jan Hudec

Reputation: 76346

Any user-settable variable can be defined with set:

set(OPT2 "Default" CACHE STRING "Helpstring")

so -march would be something like:

set(ARCH "" CACHE STRING "Architecture to tell gcc to optimize for (-march)")

Upvotes: 61

Related Questions