[CMake] INCLUDE cannot find file

Dizzy dizzy at roedu.net
Tue Oct 2 05:42:46 EDT 2007


On Tuesday 02 October 2007 12:27:24 Shiqing Fan wrote:
> Hi all,
>
> I just got some problem using INCLUDE. I don't know whether I'm in a
> wrong way.
>
> I used it like this:
>
> In top level, include a CMakeLists file from a subdirectory sub1 :
> INCLUDE (sub1/CMakeLists.txt)

This kinda beats the purpose of add_subdirectory. 
Replace "INCLUDE(sub1/CMakeLists.txt)" with "add_subdirectory(sub1)" which 
should do the same thing but it is cleaner IMO.

> In sub1's CMakeLists.txt, include another CMakeLists file in sub1's
> subdirectory  sub2: INCLUDE (sub2/CMakeLists.txt), and CMake says the
> CMakeLists.txt of sub2 cannot be found.

Strange, I thought that relative paths to INCLUDE are always considered 
relative to ${CMAKE_CURRENT_SOURCE_DIR} so it should have worked. But then 
again it beats the purpose of add_subdirectory().

-- 
Mihai RUSU					Email: dizzy at roedu.net
			"Linux is obsolete" -- AST


More information about the CMake mailing list