add_library() isn't aware of h-file location like add_executable()
greenduck opened this issue · comments
greenduck commented
If I use add_executable()
it automatically "knows" where to find every h-file.
However, add_library()
with the same source files (except for main.cpp) requires adding target_include_directories()
with the locations of all the h-files.
Shouldn't CPM find the h-files "for everyone" ?
Radagan commented
I'm having a similar problem with an executable using CPM 0.40.0 with our own libraries hosted on GitLab. Additionally, the libraries are not being built for some reason, so linking fails.
For example:
CPMAddPackage("gh:fmtlib/fmt#10.2.1")
...works fine, but this:
CPMAddPackage(
NAME common
VERSION 1.0.9
GIT_REPOSITORY git@-----removed-----.git
)
requires this to resolve the includes:
target_include_directories(myapp PUBLIC
src
$<BUILD_INTERFACE:${common_SOURCE_DIR}/include>
)