vincentlaucsb / csv-parser

A high-performance, fully-featured CSV parser and serializer for modern C++.
MIT License
901 stars 150 forks source link

Provide directory of library's header as the include directory #220

Closed grosscol closed 4 months ago

grosscol commented 6 months ago

Avoid having consumers need to know or declare internal structure of project.

E.g. a project that is using this library could then get the library using FetchContent_Declare

FetchContent_Declare(
  csv  
  GIT_REPOSITORY https://github.com/vincentlaucsb/csv-parser.git
  GIT_SHALLOW TRUE 
  GIT_TAG 2.1.3 
) 

Then use the this library without having to worry about the specifics of where it's located.

target_include_directories(my_project
  PUBLIC
    ${CMAKE_SOURCE_DIR}/include
  PRIVATE
    csv
) 

target_link_libraries(my_project PRIVATE csv)

This would also greatly simplify including this in an existing project as the user would not have to manually clone the repo as if it were part of the code base they're maintaining.