MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0015709 | CMake | CMake | public | 2015-08-24 08:39 | 2016-06-10 14:31 |
Reporter | Jan Christoph Uhde | ||||
Assigned To | Kitware Robot | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | moved | ||
Platform | OS | OS Version | |||
Product Version | |||||
Target Version | Fixed in Version | ||||
Summary | 0015709: variables defined state is not reset after using it for iteration in foreach | ||||
Description | When using a prior undefined variable in a foreach(x ${foo}) loop it is still defined after the loop. We noticed it due to the following warning: /usr/share/cmake-3.2/Modules/CheckSymbolExists.cmake: 53 macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) 54 if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") -- Looking for include file pthread.h - found CMake Warning (dev) at /usr/share/cmake-3.2/Modules/CheckSymbolExists.cmake:54 (if): Policy CMP0054 is not set: Only interpret if() arguments as variables or keywords when unquoted. Run "cmake --help-policy CMP0054" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Quoted variables like "x" will no longer be dereferenced when the policy is set to NEW. Since the policy is not set the OLD behavior will be used. Call Stack (most recent call first): /usr/share/cmake-3.2/Modules/CheckSymbolExists.cmake:50 (_CHECK_SYMBOL_EXISTS) /usr/share/cmake-3.2/Modules/FindThreads.cmake:133 (CHECK_SYMBOL_EXISTS) 5axis/test/exactoutputBTOneFile/CMakeLists.txt:13 (find_package) This warning is for project developers. Use -Wno-dev to suppress it. The name "x" was not a good choice. But the behavior is really unintuitive. Cheers Jan | ||||
Steps To Reproduce | cmake_minimum_required(VERSION 3.2) set(FOO "this" "is" "borken") foreach(x ${FOO}) message(mesage: ${x}) endforeach() if(DEFINED x) message("x is still defined") endif() | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2015-08-24 08:39 | Jan Christoph Uhde | New Issue | |||
2015-08-24 09:03 | kislinsk | Note Added: 0039317 | |||
2015-08-24 09:15 | Nils Gladitz | Note Added: 0039318 | |||
2015-08-24 10:01 | Brad King | Note Added: 0039321 | |||
2015-08-24 11:14 | Ben Boeckel | Note Added: 0039324 | |||
2016-06-10 14:29 | Kitware Robot | Note Added: 0042826 | |||
2016-06-10 14:29 | Kitware Robot | Status | new => resolved | ||
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved | ||
2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot | ||
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|