When using a multi-config generator like Visual Studio, objects and libraries are (by default) placed in ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>. Now, suppose I have a library target, myLib and I want to process it with some script ${PROJECT_SOURCE_DIR}/tools/process.bat and place its output next to myLib. I try:
For some cases, you can use the variable CMAKE_CFG_INTDIR containing a buildtool-specific string which expands to the active configuration at build time.
For more complex cases, sometimes you have to bite the bullet and create a separate custom command for each configuration and then “assign” it to the appropriate configuration by other means (such as a config-conditional genex in the list of sources, or creating a custom target for each config, or …)
That’s not just “cool”, that’s absolutely fantastic!, at least in my view. Thanks for letting me know. Oh, the number of workarounds I had to write around that one…
Now, I can just hope I will be given the time to reverse them all