MantisBT - CMake
View Issue Details
0015780CMakeCMakepublic2015-10-10 14:122016-06-10 14:31
Kjell Irgens 
Kitware Robot 
normalminoralways
closedmoved 
LinuxFedora22
CMake 3.3.2 
 
0015780: Dependencies relative to /usr/include are ignored
Include files which are included relative to /usr/include (or /usr/local/include) do not end up in depend.make. I do not know if this is some kind of optimization to speed up dependency checking, but there should at least be some way to ensure that a specific subdirectory of /usr/include (like /usr/include/curl in the example below) is included.

The way it works on unix-like systems now, some external projects (like gtk) have include dependencies checked while others (like curl) do not. This is not very consistent.

This may of course be a Fedora-specific problem, I have not checked that.
CMakeLists.txt:

cmake_minimum_required (VERSION 3.2)
project(mytest VERSION 1.0)
set(PROJECT_RELEASE rc2)
include_regular_expression("^.*$" "^.*$")
find_package (CURL REQUIRED)
add_executable (a.out main.cpp)

main.cpp:

#include <curl/curl.h>
int main() {return 0;}


Then run:
cmake .
make

Output of make:
CMake Error: Cannot find file "curl/curl.h".
[ 50%] Building CXX object CMakeFiles/a.out.dir/main.cpp.o
[100%] Linking CXX executable a.out

ls -l /usr/include/curl/curl.h
-rw-r--r--. 1 root root 89014 Dec 28 2014 /usr/include/curl/curl.h

No tags attached.
Issue History
2015-10-10 14:12Kjell IrgensNew Issue
2015-10-10 14:57Greg JungNote Added: 0039563
2015-10-10 16:23Kjell IrgensNote Added: 0039564
2016-06-10 14:29Kitware RobotNote Added: 0042852
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0039563)
Greg Jung   
2015-10-10 14:57   
Use "curl/curl.h" and it works ok. Brackets imply looking in the
system include directories attached to the compiler.
(0039564)
Kjell Irgens   
2015-10-10 16:23   
It did now work any better for "curl/curl.h" here. Dependencies are added for other include files in brackets, as long as they are relative to a different directory like/usr/include/gtk-2.0. I really don't see the logic here.

Even if this is how it works, it is unfortunate that CMake has a different idea of where to look for include files than the compier does. I have never seen a C/C++ compiler on any UNIX-like platform that has not found include files relative to /usr/include.
(0042852)
Kitware Robot   
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.