Closed jfinken closed 2 months ago
I can't find any evidence that CMAKE_<LANG>_FLAGS
is expected to take it's value from an environment variable with the same name. In fact, the documentation specifically says that CMAKE_C_FLAGS
and CMAKE_CXX_FLAGS
take their initial value from the CFLAGS
and CXXFLAGS
environment variables respectively.
When I use the proper environment variables, this seems to work as expected. Also, I can reproduce the behavior you described here outside of colcon by simply invoking cmake directly on the project, so I don't see how this could be a problem in colcon itself.
@jfinken, do you still believe there is a problem with colcon's behavior here, or can this ticket be closed?
@jfinken, do you still believe there is a problem with colcon's behavior here, or can this ticket be closed?
My apologies. Yes this ticket can be closed. Thank you.
The below describes a reduction exhibiting the symptom:
osrf/ros:humble-desktop)
:ros2 pkg create --build-type ament_cmake <package_name>
CMAKE_C_FLAGS
andCMAKE_CXX_FLAGS
are exported by a pre-colcon-build step involving conan.CMakeLists.txt
, print outCMAKE_C_FLAGS
andCMAKE_CXX_FLAGS
:colcon build
, those variables are empty:The solution is to force the set in
CMakeLists.txt
. But why?