colcon-cmake
colcon-cmake copied to clipboard
MSBuild not supported?
I'm trying to run colcon build with MSBuild command line tools (free) rather than Visual Studio (licenced). I'm trying to compile ROS2/Humble.
I could force this compiler to be used by adding --cmake-args "-GNMake Makefiles" -DCMAKE_BUILD_TYPE=Release, however, I encounter issues mainly because colcon code checks if 'Visual Studio' in generator: and if false code considers we are using MAkefile generator, while here it's NMake, which should be treated as 'Visual Studio'.
Is it intended that MSBuild is not supported? Why do we need the whole Visual Studio IDE to compile a project?
Which specific issues are encountering? Did you try to use Ninja instead of NMake Makefiles?
Furthermore, note that it should be perfectly fine to use msbuild to build the .sln files generated by the Visual Studio CMake generators.
I did not try Ninja.
When I set "-GNMake Makefiles" -DCMAKE_BUILD_TYPE=Release, the error I get is NMAKE : fatal error U1065: option 'j' non valide
I suspect it's because of some tests like if 'Visual Studio' in generator: in site-packages\colcon_cmake\task\cmake\build.py. _get_make_arguments ends up adding -j20 to build parameters, while this is not a valid NMake parameter.
Furthermore, note that it should be perfectly fine to use msbuild to build the .sln files generated by the Visual Studio CMake generators. But CMake is unable to generate .sln files using Visual Studio generator if Visual Studio is not installed. It reports "Generator Visual Studio 17 2022 could not find any instance of Visual Studio." Even if I sourced MSBuild environment before running colcon build.
Any news on this matter? Usually flutter will make colcon find Visual Studio but not this time. Is stuck and cannot understand why. Have two almost identical setups, one works but not the other. If I manually compile the node with CMake it works but not when using colcon.