I can't seem to find this answer anywhere.
I have several libraries that are header-only due to being templatized.
What I'd like is to provide a
CMakeLists.txt under each of them that exports their
include folder as an
include
location, if that makes sense.
See what I've tried.
One option would be to include an empty
cmake_dummy.cpp file with
htcw_bits
and other similar header only libraries just to give
CMake
something to bind to but this seems sloppy as heck.
Surely, they've thought of this use case and I'm just not looking in the right place.
What I have tried:
Note below, I'd like htcw_bits to have its own
CMakeLists.txt to export a
target_include_directory
as
PUBLIC
:
However, I cannot do it since there are no source files with the
htcw_bits
project - only headers. If I try
add_library(htcw_bits)
, it will fail.
add_library(htcw_io lib/htcw_io/src/io_stream.cpp)
target_include_directories(htcw_io PUBLIC
"${PROJECT_SOURCE_DIR}/lib/htcw_bits/include"
"${PROJECT_SOURCE_DIR}/lib/htcw_io/include"
"${PROJECT_BINARY_DIR}")