I have a project with the following structure:
Projeto A:
| CMakeLists.txt
| main.cpp
| #include "ProjetoB/ClassB.cpp"
| #include "ProjetoC/ClassC.cpp"
| vendor/
| Projeto B:
| CMakeLists.txt
| ClassB.cpp
| Helper.h
| Projeto C:
| CMakeLists.txt
| ClassC.cpp
| #include "ProjetoB/Helper.h"
My CMake Project A file looks like this:
cmake_minimum_required(VERSION 3.6)
project(ProjetoA)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/build/")
set(SOURCE_FILES main.cpp)
add_executable(ProjetoA ${SOURCE_FILES})
MACRO(LINK_PROJECT_LIBRARY lib)
target_link_libraries(ProjetoA ${lib})
ENDMACRO()
include_directories(vendor/ProjetoB/)
LINK_PROJECT_LIBRARY(ProjetoB)
include_directories(vendor/ProjetoC/)
LINK_PROJECT_LIBRARY(ProjetoC)
My problem starts with me trying to include #include "ProjetoB/Helper.h"
in ClassC, because if I do not put this include cmake finds all dependencies and compiles cute. But as I need to include it does not even find the file, does my include_directories
propagate to the other cmake? I wanted to make a dependency system a little more dynamic.