View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0016098 | CMake | CMake | public | 2016-05-10 10:41 | 2016-06-10 14:31 | ||||
Reporter | tibur | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | OS | Linux / Windows | OS Version | ||||||
Product Version | CMake 3.5.2 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0016098: CMake fails to read its own cache after writing a variable with a carriage return. | ||||||||
Description | I let cmake read a version number from a file, and then store a variable made from this version number string. {{{ cmake_minimum_required(VERSION 2.8.9) file(READ "version.txt" API_VERSION) string(REPLACE "." ";" API_VERSION_LIST ${API_VERSION}) list(GET API_VERSION_LIST 0 API_VERSION_MAJOR) list(GET API_VERSION_LIST 1 API_VERSION_MINOR) list(GET API_VERSION_LIST 2 API_VERSION_PATCH) #string(STRIP ${API_VERSION_PATCH} API_VERSION_PATCH) set(TEST "${API_VERSION_PATCH}_TEST" CACHE STRING "Offending entry") }}} If the version.txt file contains a newline at the end, then the corresponding variable is broken within cmake cache. CMake then complains: CMake Error: Parse error in cache file [...]/cmake_bug/build/CMakeCache.txt. Offending entry: _TEST If we look at CMakeCache.txt we can see the following lines: TEST:STRING=4 _TEST | ||||||||
Steps To Reproduce | Get both files. Use cmake first to create the build directory, then a second time on that build folder. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | version.txt [^] (6 bytes) 2016-05-10 10:41 [Show Content]
CMakeLists.txt [^] (398 bytes) 2016-05-10 10:41 [Show Content] | ||||||||
Relationships | |
Relationships |
Notes | |
(0041044) Brad King (manager) 2016-05-10 13:55 |
Here is an even simpler example CMakeLists.txt: cmake_minimum_required(VERSION 3.5) project(Issue16098 NONE) set(TEST "a\nb" CACHE STRING "Offending entry") The cache format was never designed to encode newlines. One approach may be to truncate values at newlines when writing the cache and issue a warning. |
(0043001) Kitware Robot (administrator) 2016-06-10 14:29 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2016-05-10 10:41 | tibur | New Issue | |
2016-05-10 10:41 | tibur | File Added: version.txt | |
2016-05-10 10:41 | tibur | File Added: CMakeLists.txt | |
2016-05-10 13:55 | Brad King | Note Added: 0041044 | |
2016-06-10 14:29 | Kitware Robot | Note Added: 0043001 | |
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 |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |