Using WINDOWS_EXPORT_ALL_SYMBOLS with PRE_LINK or PRE_BUILD makes build failing
I found a bug notification in the CMake mailing list that also happened to me.
Link: https://cmake.org/pipermail/cmake/2017-June/065585.html (see the part after Additional BUG
).
In short, when:
- using Windows + Ninja + MSVC
- enabling WINDOWS_EXPORT_ALL_SYMBOLS
- having additional PRE_LINK or PRE_BUILD step defined
- and building the project...
The build fails with the following error: Couldn't open file 'XYZ.cpp.obj' with CreateFile()
. This is because the PRE_LINK/PRE_BUILD step changed the working directory, and that messes with the __create_def
.