View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015970 | CMake | CMake | public | 2016-02-11 13:44 | 2016-06-10 14:31 | ||||
Reporter | jbohren | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | Linux | OS | Ubuntu | OS Version | 14.04 | ||||
Product Version | CMake 2.8.12.2 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0015970: CMake changes order of include directories when a directory is specified both as a SYSTEM and non-SYSTEM include | ||||||||
Description | I ran into a problem recently where a package I was building set a SYSTEM include directory which was already a non-SYSTEM include directory imported from a dependency. When this happened, CMake dropped the non-SYSTEM directory in favor of the SYSTEM one, causing my build to fail. According to GCC [1], it gives precedence to non-SYSTEM include directories, and specifying both for the same path produces a warning. [1] https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html [^] > All directories named by -isystem are searched after all directories named by -I, no matter what their order was on the command line. If the same directory is named by both -I and -isystem, the -I option is ignored. GCC provides an informative message when this occurs if -v is used. With CMake, if both are specified, it drops the non-SYSTEM include and fails silently. For example, when building this project with any recent version of CMake on Linux, the build command is: ```bash /usr/bin/c++ -isystem /path/to/overlay/devel/include -I/opt/ros/indigo/include -o CMakeFiles/foo.dir/foo.cpp.o -c /home/jbohren/scratch/isystem/foo.cpp ``` But with the three `incude_directory` options given in `CMakeLists.txt`, I would expect it to read: ```bash /usr/bin/c++ -I/path/to/overlay/devel/include -I/opt/ros/indigo/include -isystem /path/to/overlay/devel/include -o CMakeFiles/foo.dir/foo.cpp.o -c /home/jbohren/scratch/isystem/foo.cpp ``` Even the following would maintain the order of the search paths, since the non-SYSTEM directories are all scanned before the SYSTEM ones: ```bash /usr/bin/c++ -I/path/to/overlay/devel/include -I/opt/ros/indigo/include -o CMakeFiles/foo.dir/foo.cpp.o -c /home/jbohren/scratch/isystem/foo.cpp ``` | ||||||||
Steps To Reproduce | Build this trivial CMake project to observe the effect: https://github.com/jbohren/isystem [^] | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0042938) 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-02-11 13:44 | jbohren | New Issue | |
2016-06-10 14:29 | Kitware Robot | Note Added: 0042938 | |
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 |