[CMake] "Can not open file" Problem

William A. Hoffman billlist at nycap.rr.com
Fri Dec 23 16:28:40 EST 2005


At 03:56 PM 12/23/2005, Chunyan Jiang wrote:
>Dear Cmake users,
>I meet a strange problem. I make project using VC++ 6 under WindowsXP.
>I have a project and some classes. For example, MyProject and class A, class B
>If I organize files as:
>/MyProject/CMakeLists.txt
>/MyProject/A.h
>/MyProject/sub/B.h
>
>In A.h file, #include "B.h"
>
>Build the project, there is error messages:
>Fatel error: can not open B.h or no such file
>
>If I store A.h and B.h in same folder, there is no errors. If I
>organize files as:
>/MyProject/CMakeLists.txt
>/MyProject/B.h
>/MyProject/sub/A.h
>
>In A.h file, #include "B.h"
>
>There is also no errors.
>In CMakeLists, I just set it as
>
>SET(HEADERS
>A.h
>sub/B.h
>)

You need to use the INCLUDE_DIRECTORIES command.
INCLUDE_DIRECTORIES(${MyProject_SOURCE_DIR})

A full list of commands can be found here:

http://www.cmake.org/HTML/Documentation.html

Also, there is a tutorial here:
http://www.cmake.org/Wiki/CMake

-Bill



More information about the CMake mailing list