The following issue has been SUBMITTED. ====================================================================== https://public.kitware.com/Bug/view.php?id=16098 ====================================================================== Reported By: tibur Assigned To: ====================================================================== Project: CMake Issue ID: 16098 Category: CMake Reproducibility: always Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2016-05-10 10:41 EDT Last Modified: 2016-05-10 10:41 EDT ====================================================================== Summary: 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. ====================================================================== 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 ====================================================================== -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers