Search code examples
cmakehlsl

How can I change the compiling dir of hlsl files using CMAKE?


I am using CMake 3.9.1, and I am already changing my project RUNTIME_OUTPUT_DIRECTORY to a different folder.

However, I want to change the output of hlsl files(cso).


Solution

  • The following works for CMAKE 3.9.1 visual studio

    add_custom_command(TARGET ${projectName} POST_BUILD COMMAND cmd /c ${PROJECT_CONFIGURATION}/shadercopy.bat)
    

    It will run the .bat right after visual studio builds the project and right before it executes!