[cmake-developers] FindBoost.cmake Clang support
Manu Sánchez
manu343726 at gmail.com
Sat Mar 12 12:42:54 EST 2016
Hi,
This is my first submission to the ML, so please let me know if I did
something wrong.
I'm reaching you to ask about Clang support in the FindBoost.cmake script.
AFAIK _Boost_GUESS_COMPILER_PREFIX() function doesn't take Clang into
account, so currently configuration fails if you are using clang++ compiler
and you don't explicitly set Boost_COMPILER variable to "clang[clang
version]".
As part of a C++/CMake course I'm giving I have been modifying the Boost
bootstrapping scripts I did for biicode past year (See
https://github.com/Manu343726/boost). My fork now has a local copy of
FindBoost.cmake that adds the following lines at the beginning of
_Boost_GUESS_COMPILER_PREFIX() function to guess clang prefix:
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE out)
string(REGEX REPLACE ".*clang version ([0-9]+)\\.([0-9]+).*"
"\\1\\2" _boost_COMPILER_VERSION "${out}")
set(_boost_COMPILER "-clang${_boost_COMPILER_VERSION}")
if(Boost_DEBUG)
message(STATUS "EXPERIMENTAL: Clang compiler.
_boost_COMPILER = ${_boost_COMPILER}")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel"
... (Original code follows here)
(Link https://github.com/Manu343726/boost/blob/master/blocks/boost/install/FindBoost.cmake#L404)
As you can see the approach is very similar to what's currently done
with gcc: Getting compiler version string and extracting required
version numbers with a regex.
I would like to know if this lack of support is intended behavior,
else propose to patch this if you find my changes above useful.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160312/d65a89fd/attachment.html>
More information about the cmake-developers
mailing list