Linux: How to set DATA_DIR to same folder where bin located?

How can I build VCMI for Linux with set DATA_DIR to same folder where bin file located?
I tried

cmake ../vcmi-src -DCMAKE_BUILD_TYPE=Debug -DDATA_DIR=.

But it does no help. I’m getting this warnings:

In file included from <command-line>:0:0:                                                   
/usr/include/stdc-predef.h:59:1: warning: /home/1/vcmi/build/lib/cotire/vcmi_CXX_prefix.hxx.gch: not used because `M_DATA_DIR' defined as ` "/usr/local/."' not ` "/usr/local/share/vcmi"' -Winvalid-pch]
 #endif
 ^

Symlinks does not help either. I want to get 2 or 3 working VCMI folders with different Data files.

Thanks for your help!

Actually vcmi code is fine - I just ran same “cmake” command from empty directory and both cmake & make finished fine.

You need to clean your build directory - just delete everything from it and re-run cmake. It seems that cotire cached PCH’s somewhere so once you redefined data dir gcc data dir in PCH was not updated.

However instead of redefining data dir I would suggest redefining XDG directories to direct vcmi to data files you want to use.

Place your data in some directory, clean vcmi data dir to make sure that vcmi won’t use anything from there and run this:
XDG_DATA_DIRS=/path/to/data/1 vcmiclient
vcmi reads data from DATA_DIR and from XDG_DATA_DIRS. So if data dir is empty it will only use XDG_DATA_DIRS.