Open cottsay opened 3 years ago
Note that in my case, colcon's not finding the CMake cache variable CMAKE_PROJECT_NAME
was due to its expecting CMakeCache.txt
in the "wrong" folder. You can find the full description in my self-answered question How can I make colcon work with a plain preset-based CMake project with multiple presets in parallel?.
I add this comment here because that's where I landed searching for my problem.
There's some code in
colcon_cmake
which skips the package build whenCMAKE_PROJECT_NAME
is not set or could not be detected. When this case is triggered and the warning is printed because the cache is not readable, the code incolcon_ros
tries to detect the availability of aninstall
target, but fails to do so as this requires reading the cache as well. There appears to be an attempt to suppress this sort of error if the build invocation failed, but because of howcolcon_cmake
returned without an error, this logic fails and a backtrace is printed.https://github.com/colcon/colcon-ros/blob/eb0b932cf7b1f3f5a720804e67f3c1a0f8995ca8/colcon_ros/task/cmake/build.py#L38-L44
The situation that led to this state was initially caused by user error, in which I had accidentally left the remnants of a prior invocation of CMake within the package sources. Removing these files resolved that specific issue.