[CMake] How do you put specific files in the build directory?
Michael Jackson
mike.jackson at bluequartz.net
Wed Jun 1 12:08:06 EDT 2011
What they do is hard code the path to the zip file into a preprocessor define and then use that preprocessor define in their code. So you have a header template:
ZipFileLocation.h.in and in there have something like this:
#define ZIP_FILE_LOCATION @ZIP_FILE_LOCATION@
Then in your normal CMakeLists.txt file you have this:
set (ZIP_FILE_LOCATION "some path to your zip file")
configure_file(ZipFileLocation.h.in ${PROJECT_BINARY_DIR}/ZipFileLocation.h @ONLY immediate)
include_Directories(${PROJECT_BINARY_DIR})
Then in your source file
#include "ZipFileLocation.h"
Those are the rough instructions. All from memory. I may have missed something.
___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson at bluequartz.net
BlueQuartz Software Dayton, Ohio
On Jun 1, 2011, at 11:31 AM, Doug wrote:
> In my project I build a library and a series of tests; so the result is something like:
>
> build/libblah.so
> build/tests/test_series
> build/tests/test_archives
> etc.
>
> One of the tests I want to run (test_archives) reads from a zip file; however, for my test to run successfully it needs a zip file place into the tests folder.
>
> Current the test zip file lives in src/tests/test.zip
>
> What's the right way to do this?
>
> I see some libraries use configure_file to generate headers in the build directory, but that doesn't seem useful in this case...
>
> Cheers,
> Doug.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
More information about the CMake
mailing list