c++ - How do I add an include directory from outside the root folder with CMake? -


this first cmakelists.txt code:

#cmake_minimum_required (version 2.6) project (project)  add_subdirectory(src)  include_directories(${/path_to_directory}/include) 

and cmakelists.txt in subdirectory

set (cmake_c_flags "-wall -g")  file(glob srcs *.cpp *.hpp *.h)  add_executable(source ${srcs}) 

i'm still unable include path_to_directory in project

edit: didn't work either:

file(glob mylib *.cpp *.hpp *.h)  add_executable(includesource ${mystuff}) target_include_directories(     mystuff     public ${path_to_directory}/include ) 

even if question not clear, guess want target_include_directories (here documentation) instead of include_directories.

from documentation:

specify include directories or targets use when compiling given target.

you can use as:

target_include_directories(     your_target_name     public ${/path_to_directory}/include ) 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -