[CMake] How to define datafiles?

Campbell Barton ideasman42 at gmail.com
Sun Apr 24 10:56:08 EDT 2011


2011/4/23 YangXi <jiandingzhe at msn.com>:
> In my program, I have several pictures and plain-text data files. Usually in
> a unix system, they should be placed on /usr/share/my_program/some_place.
> How could I define those files in CMakeLists, and make their location known
> by the program?
> Thanks!

first define the prefix in CMake so you can use it in your C program.
add_definitions(-DPREFIX="${CMAKE_INSTALL_PREFIX}")

the C program can then add the rest of the path "share/my_program/some_place"

You'll also want to install this file so its copied on "make install"


-- 
- Campbell


More information about the CMake mailing list