View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015211 | CMake | CMake | public | 2014-10-18 16:52 | 2015-04-06 09:07 | ||||
Reporter | Timo Korthals | ||||||||
Assigned To | |||||||||
Priority | high | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | no change required | ||||||
Platform | amd64 | OS | Ubuntu | OS Version | 14.04.1 | ||||
Product Version | CMake 2.8.12.2 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0015211: Faulty parsing of variables with multi-line content | ||||||||
Description | cmake (above 2.8.7 up to master/head) fails to parse variables which have more than two lines (and therefore two 'newline' character) in it. The outcome of it is, that the project is unmakeable, because of the faulty produced makefiles. As a minimal example I define multiple include directories in the variable "GCC_INCLUDES" and hand it over to "include_directories", which produces the "CXX_FLAGS" in "flags.make". I give you first an working example with the corresponding output file, and then an example with the faulty output: Working "CMakeLists.txt" -----------------------START cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR) project ("helloWorld") set(GCC_INCLUDES "/test1\n/test2") include_directories( ${GCC_INCLUDES} ) add_executable("helloWorld" main.cpp) -----------------------END Correct outputfile "CMakeFiles/helloWorld.dir/flags.make" -----------------------START # CMAKE generated file: DO NOT EDIT! # Generated by "Unix Makefiles" Generator, CMake Version 2.8 # compile CXX with /usr/bin/c++ CXX_FLAGS = -I/test1 -I/test2 CXX_DEFINES = -----------------------END Faulty "CMakeLists.txt" -----------------------START cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR) project ("helloWorld") set(GCC_INCLUDES "/test1\n/test2\n/test3") include_directories( ${GCC_INCLUDES} ) add_executable("helloWorld" main.cpp) -----------------------END Faulty outputfile "CMakeFiles/helloWorld.dir/flags.make" -----------------------START # CMAKE generated file: DO NOT EDIT! # Generated by "Unix Makefiles" Generator, CMake Version 2.8 # compile CXX with /usr/bin/c++ CXX_FLAGS = -I/test1 -I/test2 /test3 -I/test3 CXX_DEFINES = -----------------------END | ||||||||
Steps To Reproduce | Use the CMakeLists.txt files in the section "Description" and run "cmake ." to produce the error message. Example "main.cpp" -----------------------START #include <iostream> using namespace std; int main(void) { cout << "Hallo World" << endl; return 0; } -----------------------END | ||||||||
Additional Information | I tested the following cmake versions OS: Ubuntu 12.04.4; cmake 2.8.7 Result: No parsing error OS: Ubuntu 14.04.1; cmake 2.8.7 Result: No parsing error OS: Ubuntu 14.04.1; cmake 2.12.2 Result: ERROR OS: Ubuntu 14.04.1; cmake master/head (commit d4525d7288ef935ee8b9d8cf338763498850364f) Result: ERROR | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0037052) Brad King (manager) 2014-10-20 09:11 |
The CMake language does not separate arguments on newlines in evaluated variables, only on semicolons: http://www.cmake.org/cmake/help/v3.0/manual/cmake-language.7.html#lists [^] The include_directories() command does not try to parse multiple lines either. If you have some source of information that produces one include directory on each line then it is up to you to parse it before passing to include_directories() in the documented way. You could use the string() command for that, for example. |
(0037053) Brad King (manager) 2014-10-20 09:12 |
If you need further help please ask on the mailing list: http://www.cmake.org/mailman/listinfo/cmake [^] |
(0038424) Robert Maynard (manager) 2015-04-06 09:07 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2014-10-18 16:52 | Timo Korthals | New Issue | |
2014-10-20 09:11 | Brad King | Note Added: 0037052 | |
2014-10-20 09:12 | Brad King | Note Added: 0037053 | |
2014-10-20 09:12 | Brad King | Status | new => resolved |
2014-10-20 09:12 | Brad King | Resolution | open => no change required |
2015-04-06 09:07 | Robert Maynard | Note Added: 0038424 | |
2015-04-06 09:07 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |