So here is what my project looks like, for reference:
+ <root>
+ build
+ inc
+ libsm64
+ libsm64.hpp
+ src
+ libsm64.cpp
+ CMakeLists.txt
+ CMakeLists.txt
The top-level CMakeLists.txt
:
cmake_minimum_required(VERSION 3.8)
project(libsm64)
# add source.
add_subdirectory(src)
and the CMakeLists.txt
for /src
:
add_library(libsm64 libsm64.cpp ../inc/libsm64/libsm64.hpp)
target_include_directories(libsm64 PRIVATE ../inc)
Both Visual Studio 2019 and VSCode will give me an error in libsm64.cpp
saying that it cannot open libsm64/libsm64.hpp
. Why?
EDIT: Even if I replace the relative directory references with absolute references i.e. ${libsm64_PROJECT_DIR}/inc/libsm64/libsm64.hpp
it won't work.