Updating CMake breaks ignores set(CMAKE_CXX_COMPILER ...) in CMakeLists.txt [closed]

asked 2021-07-10 20:00:38 -0600

JeffR1992 gravatar image

updated 2022-01-22 16:16:15 -0600

Evgeny gravatar image

I'm running Ubuntu 18.04 with ROS Melodic, and recently updated my CMake to version 3.20.5. However, after doing this I noticed that using set(CMAKE_CXX_COMPILER "path/to/compiler") command in CMakeLists.txt to change compilers to, say, clang++ or nvc++ doesn't work, and I instead have to change compilers in the command line by using the -DCMAKE_CXX_COMPILER command. For example,

catkin_make -DCMAKE_CXX_COMPILER=/usr/bin/clang++

Has anyone else noticed this change, and if so, is this intended or is there still a way to use set() in CMakeLists.txt? Any help would be appreciated.

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see http://wiki.ros.org/Support for more details. by gvdhoorn
close date 2021-07-11 01:27:46.356147


I can see why you've posted this here -- as you're using CMake while building software for ROS Melodic -- but this is not a ROS question. CMake is a stand-alone tool, which we just happen to use for building ROS packages.

It's well possible that Kitware has decided to change how compilers should be specified when running CMake, but that's not something we are kept up-to-date about or have any influence on.

Please post your question in a more suitable location.

If/when you do, please post a comment here with a link to your new post, so we can keep things connected.

gvdhoorn gravatar image gvdhoorn  ( 2021-07-11 01:30:03 -0600 )edit