[cmake-developers] if (FOO == BAR) ...

Alexander Neundorf neundorf at kde.org
Wed Mar 20 17:37:30 EDT 2013


On Wednesday 20 March 2013, David Cole wrote:
> Are you proposing that == behaves as STREQUAL, or as EQUAL?

None of both.
It simply compares the strings, no variable lookup. 
 
> Similarly, would you propose < and > for numbers only, or for string
> comparisons?

that's why I didn't add them ;-)

So is the safe way to actually always use variables on both sides, and never 
strings or dereferenced variables ?

set(expected_result "Intel")
if(CMAKE_CXX_COMPILER_ID STREQUAL expected_result)

 
Alex



More information about the cmake-developers mailing list