This is cmake related issue Trying to build the project, and had some problems with default clang-3.5 on build machine, so installed clang-3.7 there. Unfortunately it has no clang symlink, so i am forced to find it.
Having these lines inside CMakeLists.txt file to detect clang and set it (i know this is not very good looking find code)
# Complilers, NOTE: this section should be before the Project section
find_program( CLANG_PATH clang )
find_program( CLANGCXX_PATH clang++ )
if(NOT CLANG_PATH AND NOT CLANGCXX_PATH)
set (CLANG_SEARCH_PATH "/usr/bin/")
execute_process(COMMAND bash "-c" "ls ${CLANG_SEARCH_PATH} | grep -v clang++ | grep clang | head -1"
OUTPUT_VARIABLE CLANG_FILE )
execute_process(COMMAND bash "-c" "ls ${CLANG_SEARCH_PATH} | grep clang++ | head -1"
OUTPUT_VARIABLE CLANGCXX_FILE )
if(CLANG_FILE AND CLANGCXX_FILE)
set(CLANG_PATH "${CLANG_SEARCH_PATH}${CLANG_FILE}")
set(CLANGCXX_PATH "${CLANG_SEARCH_PATH}${CLANGCXX_FILE}")
set(CMAKE_C_COMPILER "${CLANG_PATH}")
message(STATUS "The clang compiler discovered... ${CLANG_PATH}")
set(CMAKE_CXX_COMPILER "${CLANGCXX_PATH}")
message(STATUS "The clang++ compiler discovered... ${CLANGCXX_PATH}")
else()
message(FATAL_ERROR "clang and clang++ were not found! Aborting...")
endif()
endif()
Build result is (the same for clang++)
-- The clang compiler discovered... /usr/bin/clang-3.7
-- The clang++ compiler discovered... /usr/bin/clang++-3.7
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:24 (project):
The CMAKE_C_COMPILER:
/usr/bin/clang-3.7
is not a full path to an existing compiler tool.
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
But the path seems to be correct. If i will set it just in a dummy way instead, like
set(CMAKE_C_COMPILER "/usr/bin/clang-3.7")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++-3.7")
it works
-- The C compiler identification is Clang 3.7.0
-- The CXX compiler identification is Clang 3.7.0
-- Check for working C compiler: /usr/bin/clang-3.7
-- Check for working C compiler: /usr/bin/clang-3.7 -- works
PS: I saw this one CMAKE_C_COMPILER is not a full path to an existing compiler tool however it was not very helpful. Left the same topic name though.
UPD:
$cmake --version
cmake version 3.6.2