With CMake, how to install CSV data file where library can find it?

Viewed 19

I am working on a C library. It contains a data file, as a CSV file.

The library opens and read this file as needed.

But how do I install this file, and open it (in C) in such a way that it works in both testing and after it is installed?

Right now I copy the file to the build directory so it can be found during testing. But this won't work for an installed library.

# Copy the data file with the NOAA abbreviations.
configure_file(src/noaa_grib2_params.csv ${CMAKE_CURRENT_BINARY_DIR}/noaa_grib2_params.csv COPYONLY)

Even if I install the data file with the library, how can the library open it? Does the library have to know the install path so it can find the data file?

0 Answers
Related