RFC: Target Attribute EXPORT_COMPILE_COMMAND forces OPT-IN for inclusion in output database
Using the current git snapshot of 693f4c70
It appears that using
set_property(TARGET wantThisTargetIncluded PROPERTY EXPORT_COMPILE_COMMANDS TRUE)
also requires...
set_property(TARGET doNOTwantThisTargetIncluded PROPERTY EXPORT_COMPILE_COMMANDS FALSE)
for every other target in the overall build...
Since this is such a new option I imagine I might be using it incorrectly.
RFC: Should usage of the target attribute EXPORT_COMPILE_COMMANDS with a TRUE condition force all other projects in a build to be FALSE such that when a user decides they:
-
do not want all files in the build to be included
-
they must manually add set(TARGET...EXPORT_COMPILE_COMMANDS) to each target they want included
A simpler approach might be to add a global flag:
set(CMAKE_EXPORT_COMPILE_COMMANDS_OPT_IN ON CACHE INTERNAL "force all targets to require EXPORT_COMPILE_COMMANDS target attribute")
Additionally another RFC would be:
Can per-project output files be created instead of one global compile_commands.json file?
Such that
PROJECT(myProject)
with various targets set with EXPORT_COMPILE_COMMANDS
emits "myProject_compile_commands.json" containing said targets?
or even a project specific attribute for the output file name?
The background for these questions is:
A) We have a cmake build which comprises hundreds of nested directories
B) containing more than 100 cmake PROJECT()'s and TARGETS
C) we want to have specific projects scanned by tools which use compilation databases as input for such things as additional code generation tasks...
D) we have to preprocess the compile_commands.json file to remove unwanted targets
E) churn in project directory structure will inevitably ruin preprocessing scripts as the two become out of sync
I appreciate your input and commentary and please tell me if I am just being dumb when using this feature.
Cheers