Skip to content
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

Unable to generate compile_commands.json on Windows #115

Closed
Scotty1701 opened this issue Feb 4, 2022 · 1 comment
Closed

Unable to generate compile_commands.json on Windows #115

Scotty1701 opened this issue Feb 4, 2022 · 1 comment

Comments

@Scotty1701
Copy link

I'm attempting to generate a compile_commands.json file for use with clangd, however the file is not generated (neither on a package level nor the workspace level). Attempting to build the turtlesim package from ros_tutorials with

PS D:\Documents\dev_ws> colcon build --merge-install --event-handlers console_cohesion+ --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

gives the following warning:

CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_COMPILE_COMMANDS

My platform is Windows 10 with Ros2 Foxy installed from the aka.ms/ros Chocolatey package.

I build colcon from source following the instructions in the docs, and colcon version-check gives:

colcon-cd 0.1.1: up-to-date
colcon-cmake 0.2.26: up-to-date
colcon-core 0.7.1: up-to-date
colcon-defaults 0.2.6: up-to-date
colcon-devtools 0.2.3: up-to-date
colcon-library-path 0.2.1: up-to-date
colcon-metadata 0.2.5: up-to-date
colcon-mixin 0.2.1: up-to-date
colcon-notification 0.2.13: up-to-date
colcon-output 0.2.12: up-to-date
colcon-package-information 0.3.3: up-to-date
colcon-package-selection 0.2.10: up-to-date
colcon-parallel-executor 0.2.4: up-to-date
colcon-pkg-config 0.1.0: up-to-date
colcon-powershell 0.3.7: up-to-date
colcon-python-setup-py 0.2.7: up-to-date
colcon-recursive-crawl 0.2.1: up-to-date
colcon-ros 0.3.22: up-to-date
colcon-test-result 0.3.8: up-to-date
colcon-zsh 0.4.0: up-to-date

Attempting the same in an Ubuntu 20.04 with identical colcon versions correctly generates compile_commands.json on a package and workspace level.

I also tested on windows with the change proposed in #114, however this did not result in any changed behavior. Additionally, I tested ommitting the --merge-install option, which produced no change for either platform.

@Scotty1701
Copy link
Author

This CMake flag is only implemented for Makefile Generators and Ninja (https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html). Ninja is supported on Windows, so I recommend using that instead of the default generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant