Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMAKE string options

Tags:

cmake

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.

like image 495
Cartesius00 Avatar asked Jan 03 '12 08:01

Cartesius00


1 Answers

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)") 
like image 110
Jan Hudec Avatar answered Oct 05 '22 14:10

Jan Hudec