Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm trying to do it in a similar way to Stefanct, but it doesn't work for me. So far, only the command line option works, as per how William described it.
By the time catkin_make gets to the set command in my CMakeList.txt file, its already chosen to use /usr/bin/cc and /usr/bin/c++ and gives an error c++: error: unrecognized command line option ‘-stdlib=libc++’ when I try to perform set(CMAKE_CXX_FLAGS "-v -std=c++11 -stdlib=libc++").
I set the flag in a slightly different way; by checking if clang is available before setting it.

find_program(CLANGPP clang++ HINTS /usr/local/bin /usr/bin /opt/local/bin)
if(${CLANGPP} MATCHES "clang")
set(CXX ${CLANGPP})
set(MAKE_CXX_COMPILER ${CLANGPP})
message(STATUS "CXX = ${CXX}")
endif(${CLANGPP} MATCHES "clang")

and the same for 'clang'.

I'm still trying different things, and when I get it working, I'll come back.

@Stefanct, where in your CMakeList.txt file do you put those lines? Do you have an initialisation function?