-
Notifications
You must be signed in to change notification settings - Fork 13.9k
[lldb] Use add_custom_command for SBLanguages.h #91254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Use add_custom_command instead of add_custom_target to generate SBLanguages.h.
@llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) ChangesUse add_custom_command instead of add_custom_target to generate SBLanguages.h. Full diff: https://github.com/llvm/llvm-project/pull/91254.diff 1 Files Affected:
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index a64c0d4a333425..798a92874f13d1 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -23,13 +23,13 @@ endif()
# Target to generate SBLanguages.h from Dwarf.def.
set(sb_languages_file
${CMAKE_CURRENT_BINARY_DIR}/../../include/lldb/API/SBLanguages.h)
-add_custom_target(
- lldb-sbapi-dwarf-enums
- "${Python3_EXECUTABLE}"
+add_custom_command(
+ COMMENT "Generating SBLanguages.h from Dwarf.def"
+ COMMAND "${Python3_EXECUTABLE}"
${LLDB_SOURCE_DIR}/scripts/generate-sbapi-dwarf-enum.py
${LLVM_MAIN_INCLUDE_DIR}/llvm/BinaryFormat/Dwarf.def
-o ${sb_languages_file}
- BYPRODUCTS ${sb_languages_file}
+ OUTPUT ${sb_languages_file}
DEPENDS ${LLVM_MAIN_INCLUDE_DIR}/llvm/BinaryFormat/Dwarf.def
WORKING_DIRECTORY ${LLVM_LIBRARY_OUTPUT_INTDIR}
)
@@ -113,9 +113,7 @@ add_lldb_library(liblldb SHARED ${option_framework}
SystemInitializerFull.cpp
${lldb_python_wrapper}
${lldb_lua_wrapper}
-
- DEPENDS
- lldb-sbapi-dwarf-enums
+ ${sb_languages_file}
LINK_LIBS
lldbBreakpoint
|
This should work if there is exactly one thing that depends on the output of this custom command. If multiple things start depending on the generated files, you may end up with weird results. See: https://cmake.org/cmake/help/latest/command/add_custom_command.html
|
Good point. I can't imagine anything needing the SB header that doesn't need the rest of the framework, but if that's the case we go through a custom target. |
Use add_custom_command instead of add_custom_target to generate SBLanguages.h. (cherry picked from commit 3809e20)
thanks |
Alex pointed out in #91254 that we only need the custom target if we had more than one target depending on it. This isn't the case upstream, but on our downstream fork, we have a second dependency. Reintroduce the target so that everything can depend on that, without the single-dependency foot-gun.
Alex pointed out in llvm#91254 that we only need the custom target if we had more than one target depending on it. This isn't the case upstream, but on our downstream fork, we have a second dependency. Reintroduce the target so that everything can depend on that, without the single-dependency foot-gun. (cherry picked from commit dad1109)
[lldb] Use add_custom_command for SBLanguages.h (llvm#91254)
Alex pointed out in llvm#91254 that we only need the custom target if we had more than one target depending on it. This isn't the case upstream, but on our downstream fork, we have a second dependency. Reintroduce the target so that everything can depend on that, without the single-dependency foot-gun. (cherry picked from commit dad1109) (cherry picked from commit 26f8029)
Use add_custom_command instead of add_custom_target to generate SBLanguages.h.