I am working on a larger library, which we now want to build with cmake.
The structure is somewhat like this:
foo/
- CMakeLists.txt
- include/
-- foo/
--- utils/
---- utils.hpp
--- foo.hpp
- src/
-- utils/
--- utils.cpp
-- foo.cpp
And the root CMakeLists.txt
looks like this:
cmake_minimum_required(VERSION 3.15)
project(foo CXX)
target_include_directories(
foo
PUBLIC
include
PRIVATE
src
)
target_sources(
foo
PRIVATE
src/foo.cpp
src/utils/utils.cpp
)
The problem im seeing now is that the target_sources()
call will become very unreadable and error prone the more source files are added.
Ive read about GLOB
but also read that it is bad practice nowadays.
Whats solutions do you normaly use for libraries like this?