CMake: Print a warning if CCACHE_CPP2 is unset.

If we're compiling with clang and ccache, print a warning if CCACHE_CPP2
is unset. Doing so avoids generating a bunch of unwanted output when
warnings are enabled.

Change-Id: I6a796e8b910074ffa028ea45bc639b9461e1629e
Reviewed-on: https://code.wireshark.org/review/23646
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Gerald Combs 2017-09-20 16:19:04 -07:00 committed by Anders Broman
parent 5f667694d3
commit ed1ecfb39c
1 changed files with 4 additions and 0 deletions

View File

@ -1291,6 +1291,10 @@ if(ENABLE_CCACHE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Cl
if(CCACHE_EXECUTABLE)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_EXECUTABLE}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_EXECUTABLE}")
# http://peter.eisentraut.org/blog/2014/12/01/ccache-and-clang-part-3/
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT DEFINED(ENV{CCACHE_CPP2}))
message(WARNING "You're compiling using clang and ccache but CCACHE_CPP2 unset. This might produce unwanted warnings.")
endif()
endif()
endif()