xperious
xperious

Reputation: 249

include directories in CMake

I have a big project with cmake as build system(sorry for my english)... I have directories with files:

directory1:
    |  CMakeLists.txt
    |  directory2:
    |      |   CMakeLists.txt
    |      |    file1.h
    |      |    file1.cpp
    |    file2.h
    |    file2.cpp
    |    file3.h
    |    file3.cpp

in upper cmake file we have:

set(TARGET target)
add_executable(${TARGET}
               directory2/file1.cpp
               file2.cpp
               file3.cpp
) 

in lower cmake file we have:

include_directories(../)

at now in file1.cpp we include files as below:

 #include "file1.h"
 #include "../file2.h"
 #include "../file3.h"

what can I doing in cmake file for that we can include headers files in file1.cpp as below:

 #include "file1.h"
 #include "file2.h"
 #include "file3.h"

Upvotes: 0

Views: 900

Answers (1)

xperious
xperious

Reputation: 249

I just add to upper cmake file:

include_directories(./)

Upvotes: 2

Related Questions