-
Notifications
You must be signed in to change notification settings - Fork 49
[Foxy] - colcon build C++ with Visual Studio 2022 - change CMake version #440
Comments
I guess I have found a solution, though it was so close that I should have checked it before :/ .
So by setting env var CMAKE_COMMAND I could change the path to CMake executable:
colcon now succesfully builds my Cpp packages. I wonder if it is possible to update the build configuration to incorporate a newer version of CMake into Foxy distribution? |
The documentation suggests placing the directory with your preferred CMake binary on the |
🤦 I should have read this more carefully :D . thanks! |
@anion0278 ROS on Windows has a toolchain affinity, instead of ROS on Linux which has a distro affinity. Our binaries are compiled with the default toolchain for Visual Studio 2019, so it is required to be installed to build nodes for Noetic and Foxy. We can't change the toolchain for foxy; otherwise we would break existing deployments. With Humble, we are moving to VS2022. Both can be installed in parallel. |
Wrong button. Leaving open for consideration since installing VS2019 is getting difficult. |
I'd like to mention that if anyone intends to utilize the VS 22 compiler with a newer version of CMake, it's crucial to select versions prior to 3.24. Specifically, I would recommend using version 3.23.3 (refer to the related issue: dusty-nv/jetson-containers#181 (comment)). The newer versions of CMake introduce ament-related issues when building Turtlebot3 from source ( |
We are setting up ROS2 in our labs, with Visual Studio 2022 already installed. I try to build Cpp examples with colcon, however, it seems like the version of Cmake that is provided along with Foxy does not yet know the VS2022, so the build fails. I know that according to the official docs, only VS up to 2019 are supported, however in our case it would be beneficial to avoid installing another VS.
ROS2 Foxy was installed from binaries with Chocolately according to: https://ms-iot.github.io/ROSOnWindows/GettingStarted/SetupRos2.html
Could please suggest any option (colcon argument or env variable) to change the Cmake.exe path during the colcon build?
My steps:
The initial error pointed me to the C:\opt\ros\foxy\x64\Lib\site-packages\colcon_cmake\task\cmake\build.py script:
Which was easily "fixed" by appending '17.0': 'Visual Studio 17 2022' to the dictionary:
A new attempt to build now suggests that the Cmake provided with the Foxy does not recognize the VS 2022 C++ compiler:
By checking the version C:\opt\ros\foxy\x64\Scripts\cmake.exe --version I could see that the default vesion of CMake is 3.18.2. I hoped, that by installing a newer version of Cmake (3.23.3) and by prepending the PATH env var with its corresponding path (C:\Program Files\CMake\bin) would be sufficient to force Colcon to utilize the different version of Cmake. But it wasn't :) .
Could please suggest any option (colcon argument or env variable) to change the Cmake.exe path during the colcon build?
The text was updated successfully, but these errors were encountered: