Evaluates the condition argument of the if clause according to the Condition syntax described below. If the result is true, then the commands in the if block are executed. . Otherwise, optional elseif blocks are processed in the sa
because there can be an unintended double expansion of the first argument if the variable A happens to be defined to a string which is also the name of a CMake variable, e.g.: set (A "d") set (d "some string") if ("$ {A}" STREQUAL "some string") # this branch will be taken message ("oops...") else () message ("fine") endif ()
Then any binary tests such as EQUAL , LESS , LESS_EQUAL, ``GREATER , GREATER_EQUAL , STREQUAL , STRLESS , STRLESS_EQUAL , STRGREATER , STRGREATER_EQUAL ...
Search results for '[CMake] Problem with STREQUAL' (Questions and Answers) 4 . replies . Two problems in this C program? started 2009-06-04 22:37:00 UTC.
You ran into a rather annoying "it's not a bug, it's a feature" behavior of CMake. As explained in the documentation of the if command:. The if command was written very early in CMake's history, predating the ${} variable evaluation syntax, and for convenience evaluates variables named by its arguments as shown in the above signatures.
Both left and right hand arguments to STRLESS, STRGREATER, STREQUAL, STRLESS_EQUAL, and STRGREATER_EQUAL are independently tested to see if they are defined variables, if so their defined values are used otherwise the original value is used.
1 if target exists, else 0. $<CONFIG:cfgs> ¶ 1 if config is any one of the entries in comma-separated list cfgs, else 0.This is a case-insensitive comparison. The mapping in MAP_IMPORTED_CONFIG_<CONFIG> is also considered by this expression when it is evaluated on a property on an IMPORTED target.
True if the given string or variable's value is lexicographically greater than the string or variable on the right. if(<variable|string> STREQUAL <variable| ...
So, STREQUAL treats a parameter as a variable name if it is defined, but as a string value if it is not. (I verified this in cmIfCommand.cxx) Is this quote behavior well-known among cmake users? For others like me, I'd like this behavior to be emphasized in the cmake docs for STREQUAL.
Jul 17, 2003 · [Cmake] STREQUAL and FILE command Andy Cedilnik andy . cedilnik at kitware . com 17 Jul 2003 12:51:30 -0400. Previous message: [Cmake] STREQUAL and FILE command Next message: [Cmake] STREQUAL and FILE command Messages sorted by: