MantisBT - CMake | |||||||||||||||
View Issue Details | |||||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||||
0010773 | CMake | CMake | public | 2010-05-28 13:01 | 2011-01-31 16:01 | ||||||||||
Reporter | Modestas Vainius | ||||||||||||||
Assigned To | Brad King | ||||||||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||||||||
Status | closed | Resolution | fixed | ||||||||||||
Platform | amd64 | OS | Debian GNU/Linux | OS Version | sid | ||||||||||
Product Version | CMake-2-8 | ||||||||||||||
Target Version | CMake 2.8.4 | Fixed in Version | CMake 2.8.4 | ||||||||||||
Summary | 0010773: IF() command behaviour contradicts examples in documentation | ||||||||||||||
Description | Exerpt from `cmake --help-command if` --------------------------------------------------- The convenience feature that sometimes throws new authors is how CMake handles values that do not match the true or false list. Those values are treated as variables and are dereferenced even though they do not have the required ${} syntax. This means that if you write if (boobah) CMake will treat it as if you wrote if (${boobah}) likewise if you write if (fubar AND sol) CMake will conveniently treat it as if ("${fubar}" AND "${sol}") The later is really the correct way to write it, but the former will work as well. Only some operations in the if statement have this special handling of arguments. ---------------------------------------- Then why almost straight copy&paste code below produces different results for each pair (see Testcase: lines) when variables are set to a string value? And why is "why_is_this_string_false" constant false? cmake appears to treat "why_is_this_string_false" as variable which is really unintuitive but maybe somewhat deductable from documentation. So there is either a bug in cmake or in its documentation. | ||||||||||||||
Steps To Reproduce | project(foo) cmake_minimum_required(VERSION 2.6) set(boobah "str") set(fubar "str") set(sol "str") if (boobah) MESSAGE(STATUS "Testcase: boobah without brackets") endif(boobah) if (${boobah}) MESSAGE(STATUS "Testcase: boobah with brackets") endif (${boobah}) if (fubar AND sol) MESSAGE(STATUS "Testcase: fubar sol without brackets") endif (fubar AND sol) if ("${fubar}" AND "${sol}") MESSAGE(STATUS "Testcase: fubar sol with brackets") endif ("${fubar}" AND "${sol}") if ("why_is_this_string_false") MESSAGE(STATUS "Testcase: no, why_is_this_string_false is NOT false") endif ("why_is_this_string_false") | ||||||||||||||
Additional Information | $ rm CMakeCache.txt -f && cmake . -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /mnt/sda2/usr/bin/gcc -- Check for working C compiler: /mnt/sda2/usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /mnt/sda2/usr/bin/c++ -- Check for working CXX compiler: /mnt/sda2/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Testcase: boobah without brackets -- Testcase: fubar sol without brackets -- Configuring done -- Generating done -- Build files have been written to: /home/modax/test | ||||||||||||||
Tags | No tags attached. | ||||||||||||||
Relationships |
| ||||||||||||||
Attached Files | |||||||||||||||
Issue History | |||||||||||||||
Date Modified | Username | Field | Change | ||||||||||||
2010-05-28 13:01 | Modestas Vainius | New Issue | |||||||||||||
2010-05-31 02:15 | Rolf Eike Beer | Note Added: 0020870 | |||||||||||||
2010-05-31 03:21 | Modestas Vainius | Note Added: 0020871 | |||||||||||||
2010-05-31 07:33 | Rolf Eike Beer | Note Added: 0020872 | |||||||||||||
2011-01-14 17:20 | Brad King | Relationship added | has duplicate 0011701 | ||||||||||||
2011-01-14 17:22 | Brad King | Assigned To | => Brad King | ||||||||||||
2011-01-14 17:22 | Brad King | Status | new => assigned | ||||||||||||
2011-01-14 17:33 | Brad King | Note Added: 0024697 | |||||||||||||
2011-01-14 17:35 | Brad King | Relationship added | related to 0009123 | ||||||||||||
2011-01-14 18:30 | Brad King | Note Added: 0024698 | |||||||||||||
2011-01-14 18:30 | Brad King | Status | assigned => closed | ||||||||||||
2011-01-14 18:30 | Brad King | Resolution | open => fixed | ||||||||||||
2011-01-31 16:01 | David Cole | Fixed in Version | => CMake 2.8.4 | ||||||||||||
2011-01-31 16:01 | David Cole | Target Version | => CMake 2.8.4 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|