I have a project like this:
- root/
- main/
- include/
- *.h
- res/
- *.txt
- src/
- *.c
CMakeListst.txt
- CMakeLists.txt
The res folder is the folder with a bunch of text files which my application reads.
This is how my root/CMakeLists.txt looks like:
// Configuration stuff
add_subdirectory(main)
Then root/main/CMakeLists.txt looks like:
include_directories(include)
file(GLOB_RECURSE SOURCES *.c)
file(GLOB_RECURSE RESOURCES *.txt)
add_executable(${PROJECT_NAME} ${RESOURCES} ${SOURCES})
I thought I could add all the resources to the add_executable statement, but then I debugged my program and I found out it crashed when I tried to open the file. Lets say I have a file called foo.txt in the res/ folder, then when I do fopen("foo.txt", "r"); it returns null. How can I add custom resources?