This question already has an answer here:
CMake variable with limited valid values
(1 answer)
Closed 2 years ago.
I encountered CMake project where cache entry in cmake-gui was presented as combobox. But I can't find this project. How to add cache entry to CMakeLists.txt with values constrained with combobox?
You can set the a variable to a default value and add it to the cache.
set(COLOR_MODE "always" CACHE STRING "Should we use colors")
Then you can set the property for the variable to the list of values you want to appear in the combobox.
set_property(CACHE COLOR_MODE PROPERTY STRINGS always auto never)
Related
There is pretty new but cool feature in CMake: presets
I am confused with some of the possible values of preset: toolchainFile and installDir. This values could be set using simple cache variables, using cacheVariables entries (strictly CMAKE_TOOLCHAIN_FILE and CMAKE_INSTALL_PREFIX).
There is only a mention about toolchainFile in documentation, that states:
This field takes precedence over any CMAKE_TOOLCHAIN_FILE value.
This does not resolves my confusion. The question is: Which method should I use and what is the difference?
[...] and what is the difference?
The docs explain the difference:
If a relative path is specified, it is calculated relative to the build directory, and if not found, relative to the source directory.
The cache variable is expected to be an absolute path (typically computed from ${sourceDir}).
The question is: Which method should I use[?]
You should probably use the more specific option. It's a bit clearer and marginally less typing. Not a huge deal either way.
Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 months ago.
Improve this question
[disclosure: I asked about this earlier on the NixOS channel but didn't get an answer after 30 minutes and it's a busy channel. If I get one there, I'll replicate it here]
I'm trying to add some lines to a configuration file in NixOS (for example /etc/pam.d/sudo). The configuration options available in pam.nix do not include the line I want to add (in this case, account requisite pam_time.so), and it does not include an extraConfig option either.
I know I can create new configuration files using environement.etc.filename.text so I went with that, but sudo nixos-rebuild switch then complains that it has two sources for the configuration file, the official one and mine (mismatched duplicate entry /nix/… <-> /nix/…):
environment.etc."pam.d/sudo".text = ''blah'';
Is there a general way to append to a /etc/ configuration file (or to patch it) in NixOS?
Or is the only way to modify the system .nix files (e.g. modifying pam.nix, which I'm reluctant to do as it will collide with future updates)?
You can add lines to the default value of security.pam.services.sudo.text using mkOverride or the shortcut mkDefault to give your value the same priority as the default. You can control the order with mkOrder or the shortcuts mkBefore and mkAfter. So to append, you could do:
security.pam.services.sudo.text = pkgs.lib.mkDefault( pkgs.lib.mkAfter "# hi" );
When there are multiple values for an option, only the values with the lowest priority are kept. If there are still multiple values, they are sorted and merged. mkOverride and mkOrder create special values that the code in modules.nix recognizes when it is doing this. Ordinary values have the default priority (100) and sort order (1000). pam.nix uses mkDefault for the value it creates for the text option, which makes the priority 1000, thus ordinary values will replace it instead of being merged.
The NixOS manual section on Modularity explains a bit more.
I don't think you can do this generically for environment.etc because the target file doesn't have to match the attribute name, and pam.nix in particular does not name any of its entries in environment.etc. It is more like a list of instructions that are processed in sequence. See etc.nix and
make-etc.sh
For the files of /etc/pam.d/sudo and other files in the same directory, a simple solution is to use security.pam.services.sudo.text, but my current best attempt requires hardcoding the original contents of the file.
security.pam.services.sudo.text = ''
existing contents of /etc/pam.d/sudo …
extra lines …
'';
Hopefully other answers will come up with a more general-purpose way of altering configuration files (and keeping their original contents).
This question already has answers here:
IntelliJ IDEA 2017.1 shows "var" instead of actual type
(2 answers)
Closed 5 years ago.
Hi: I'm using intellij IDEA. when I declare a variable type as
String string ="example";
when I close the project and open it again , it is automatically show as
val string ="example";
this happens with all of the variable types automatically, then I need to click on val to revert it back to String.
Can someone guide me how to disable this feature permanently ?
Thanks in advance
You likely have "Advanced Java Folding" plugin (https://plugins.jetbrains.com/plugin/9320-advanced-java-folding) installed. As its description states, its features can be disabled in "Settings | Editor | General | Code Folding".
This question already has answers here:
How to dynamically add JSF components
(3 answers)
Closed 6 years ago.
I couldn't find a solution for this in other posts, so here is my problem.
(In advance, I use JSF 2 with Mojarra implementation and Primefaces 3.2 on a JBoss 7.1 AS)
I am building a search-mask that should be generated dynamically during runtime. I know from another post that I should use a dataTable for that. That is what I will do.
But the search-mask consists of 3 parts, the search-criterion (e.g. name, birthday,...), the operator (is, is not, larger than, in range,...) and the operand (what the user will give as search-input).
My goal is to get the search-mask get generated dynamically, BUT the type of input field is dependent on what criterion+operator has been choosen by the user.
So if the user chose criterion: "name" and operator: "is not" from the dropdown boxes, then the input field for the operand should be just a simple p:inputText.
But if the user chose criterion "birthday" and operator: "before", then the input field should be a datepicker like p:calendar.
My idea was to use a p:dataTable for a List of "SearchRow" objects where every object has an array of criteria and operands to use them in a h:selectOneMenu.
Then I add a valueChangeListener to the selectMenues and in there I calculate and create the right type of UIComponent I need as inputfield.
But I have no idea how to add that UICOmponent as the 3rd column inside the dataTable.
So is my idea any good and is there a way at all to solve my problem?
Thanks in advance!
Same solution as to the Problem described here. The article from #BalusC explains very nicely how to add components from the bean.
This question already has answers here:
Custom tags with Doxygen
(3 answers)
Closed 5 years ago.
I'd like to add a custom command to my doxygen documentation. Basically for each C function I'm writing doc for, I need to write which global variables are "touched" in read mode or write mode. It's like the "See also" list, just with a different caption.
In my file I'd like to write something like this:
/*
* \read-globals #var1, #var2
*
* \write-globals #var3
*/
I tried with an alias like this:
read-globals = \par <b>Globals read</b>\n
It works but I fear that it's style sheet independent: If tomorrow I'll want to change css, then this custom command will generate output which looks different from seealso, author and all other sections.
Basically I just want to copy the format from other standard commands.
Another option is to use to the \xrefitem command, which works too, but it requires to introduce a section as second parameter which is totally useless in my case (maybe it can be hidden somehow?).
Is there a "right way" to achieve my goal?
You can combine \xrefitem and ALIASES if you want to hide the second parameter. Here is an example I use for requirements:
ALIASES += "req=\xrefitem req \"Requirement\" \"Requirements\" "
Then in documented code:
/// \req #42 The system shall work in any situation
(from my answer to that question: Custom tags with Doxygen)