Skip to content
Snippets Groups Projects
Commit 24a1193e authored by Vassil Vassilev's avatar Vassil Vassilev
Browse files

[cmake] Do not resolve the REALPATH too early.

In some ccache setups we have the compiler soft link to ccache.

Eg. /usr/local/bin/g++ -> /usr/local/bin/ccache. If we resolve the link too
early we will take the wrong branch assuming the compiler was set as
CMAKE_CXX_COMPILER="ccache g++" and try to get the second token of the command.
parent 09c767ac
No related branches found
No related tags found
No related merge requests found
...@@ -128,9 +128,8 @@ if (UNIX) ...@@ -128,9 +128,8 @@ if (UNIX)
if(NOT CLING_CXX_PATH) if(NOT CLING_CXX_PATH)
# Remove absolute path from CMAKE_CXX_COMPILER # Remove absolute path from CMAKE_CXX_COMPILER
get_filename_component(_real_cxx_compiler ${CMAKE_CXX_COMPILER} REALPATH) get_filename_component(_name ${CMAKE_CXX_COMPILER} NAME)
get_filename_component(_name ${_real_cxx_compiler} NAME) get_filename_component(_path ${CMAKE_CXX_COMPILER} PATH)
get_filename_component(_path ${_real_cxx_compiler} PATH)
# This should probably be more general...but how? # This should probably be more general...but how?
if(_name STREQUAL "ccache" OR _name STREQUAL "distcc") if(_name STREQUAL "ccache" OR _name STREQUAL "distcc")
...@@ -198,7 +197,11 @@ if (UNIX) ...@@ -198,7 +197,11 @@ if (UNIX)
set(_path "__THISREALLYBETTERNOTBEINPATH_THANKS__") set(_path "__THISREALLYBETTERNOTBEINPATH_THANKS__")
endif() endif()
else() else()
get_filename_component(_path ${CMAKE_CXX_COMPILER} PATH) # FIXME: In some ccache setups we can have a soft link pointing to ccache
# binary. Eg. /usr/local/gcc -> /usr/bin/ccache. Resolving the realpath
# we will get to the ccache and not the intended compiler binary. This
# could be fixed if we run 'gcc -###' which will give us the correct info.
get_filename_component(_path ${CMAKE_CXX_COMPILER} REALPATH)
endif() endif()
# Test if path compiler is on PATH. # Test if path compiler is on PATH.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment