CMake User String Input -
i attempting use cmake convert generic wrapper specific one, via token replacement. hope user have input specific set of strings, have cmake configure_file, , wrapper read in values , work intended.
i aware of possibility use set set token needs replaced:
set(fav_food "sushi" cache string "what favorite food?")
as option have user select set of answers so:
set(my_selection "option a" cache string "help message variable") set_property( cache my_selection property strings "option a" "option b" "option c" )
the problem can't enumerate valid answers. there way cmake have gui pop , allow user answer string? have user fill out these values in file before calling make, i'd avoid users doing hand in files, , want take advance of cmake cache , avoid assuming user has filled out variables in file.
any advice helpful. thanks.
your first example standard way provide user-specified options cmake, typically including suitable default value have demonstrated.
you omit default value (pass empty string) , check see if value has been specified error generated when user tries configure.
in order provide these values automatically user can specific them on command line using -d= syntax:
cmake -dsome_var=some_val <path_to_cmakelists.txt>
i typically use cmake/ccmake, , assume using windows cmake-gui, similar ccmake. know of no method pop additional windows using cmake-gui. however, appear possible invoke cmake-gui aforementioned options, as described here. using method provide .bat file user edit in order enter settings wish them specify.
in opinion, long you're having them run cmake-gui, utilizing first proposed solution , letting them change values in gui "the old fashioned way" appropriate option.
Comments
Post a Comment