tschw/AntTweakBar

Vsual Studio 2019 CMake with fxc created .h files in wrong folder

Closed this issue · 4 comments

"2>compilation header save succeeded; see C:\Users\lucifer\Downloads\AntTweakBar-master\build\Renderer\TwDirect3D11_LineRectVS.h
2>Building Custom Rule C:/Users/lucifer/Downloads/AntTweakBar-master/Renderer/CMakeLists.txt
2>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(231,5): warning MSB8065: Custom build for item "C:\Users\lucifer\Downloads\AntTweakBar-master\Renderer\compile\TwDirect3D11.hlsl" succeeded, but specified output "c:\users\lucifer\downloads\anttweakbar-master\renderer\twdirect3d11_linerectvs.h" has not been created. This may cause incremental build to work incorrectly."

.h files, see below, from TwDirect3D11.hlsl with fxc are created in the path AntTweakBar-master\build\Renderer and not in AntTweakBar-master\Renderer\compile, manual copying the files to AntTweakBar-master\Renderer\compile works for compiling.
TwDirect3D11_LineRectCstColorVS.h
TwDirect3D11_LineRectPS.h
TwDirect3D11_LineRectVS.h
TwDirect3D11_TextCstColorVS.h
TwDirect3D11_TextPS.h
TwDirect3D11_TextVS.h

Please fix. I am no CMake expert.

tschw commented

Copied from the review of #3 :

This is not an error but intentional, alhough apparently bugged (missing an include directory?) and maybe we should generate those files into a subdirectory:

In my world, the source tree should always be read-only and generated code should go to somewhere in the build tree and then be added to the target. Since we're talking headers, adding them to the target is only for the IDE and the containing directory needs to be added to the list of include directories for that target too.

tschw commented

In other words, it's better to make the compiler find the files where they are generated by setting an appropriate include directory, rather than trying to generate in or copy into the source tree.

tschw commented

Looks like the include path is already set up correctly here, so the C++ compiler should find those headers.

Can you provide complete diagnostics of the build failing OOTB?

CMAKE updated to from version 3.17 to version 3.19. Issue disappeared.