Opened 9 years ago

Closed 6 years ago

#50271 closed enhancement (wontfix)

CMake Portgroup: activate CMAKE_EXPORT_COMPILE_COMMANDS

Reported by: RJVB (René Bertin) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: michaelld (Michael Dickens)
Port: cmake

Description

This is an enhancement suggestion complementary to the one filed under ticked #50246 .

CMake has the option to generate an additional file in the build directory, that contains the compile commands.This file is of little interest for building a port (it is comparable to the .CC_OPTIONS file) but its creation comes at negligible cost. It is however of considerable interest when the build directory is used with certain IDEs : KDevelop5 uses it to obtain the project contents. When absent, it will invoke a default cmake command with just enough arguments to interfere with the proper settings determined by the port.

My suggestion is thus to add -DCMAKE_EXPORT_COMPILE_COMMANDS=on to the list of cmake arguments, and to add a touch ${build.dir}/compile_commands.json to the post-configure block that also creates the cmake invocation file.

Attachments (1)

cmake-1.0.diff (5.4 KB) - added by RJVB (René Bertin) 9 years ago.

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by RJVB (René Bertin)

Attachment: cmake-1.0.diff added

comment:1 Changed 9 years ago by RJVB (René Bertin)

Turns out an empty compile_commands.json does generate errors in KDevelop; it should contain an empty json array instead.

comment:2 Changed 6 years ago by mf2k (Frank Schima)

Resolution: wontfix
Status: newclosed
Version: 2.3.4

We have moved on to the cmake 1.1 portgroup. Please open a PR against that if any of these changes should go there.

Note: See TracTickets for help on using tickets.