Ninja generator does not emit POST_BUILD commands for Apple Framework targets
I'm using CMake 3.6.2, so the file and line numbers referenced below are based on that.
I'm trying to add the following code change to LLDB to enable the LLDB framework to have an appropriate "Headers" directory in the build directory:
add_custom_command(TARGET liblldb POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_SOURCE_DIR}/include/lldb/API $<TARGET_FILE_DIR:liblldb>/Headers)
When using the Ninja generator this does not produce any errors, nor does it actually result in a command being added. Looking through the CMake sources this seems to be because in Framework targets targetOutput
is not equal to targetOutputReal
, so at cmNormalNinjaTargetGenerator.cxx:604 the else block is taken which populates the POST_BUILD
step on symlinkVars
. Further down in the file at cmNormalNinjaTargetGenerator.cxx:646, because the target is a framework the handling of symlinkVars
gets skipped (which actually seems correct). I think the fix is to add || gt.IsFrameworkOnApple()
to cmNormalNinjaTargetGenerator.cxx:604.
Thanks! -Chris