build: fix compiler issue when CMAKE_CXX_COMPILER_LAUNCHER was set to ccache (issue #1081) (#1093)

This commit is contained in:
Malte Langkabel
2020-10-19 13:05:33 +02:00
committed by GitHub
parent b54b1a6e02
commit 5795114561
+8 -8
View File
@@ -24,16 +24,16 @@ if (${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
message(FATAL_ERROR "Please create a separate build directory and call CMake again")
endif()
# speed up recompiling on unix with ccache
find_program(CCACHE_PROGRAM ccache)
if (CCACHE_PROGRAM)
message(STATUS "ccache found")
# Support Unix Makefiles and Ninja
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
if(NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER)
# speed up recompiling on unix with ccache
find_program(CCACHE_PROGRAM ccache)
if (CCACHE_PROGRAM)
message(STATUS "ccache found")
# Support Unix Makefiles and Ninja
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "Compiler launcher for CXX")
endif()
endif()
# Variables --------------------------------------------------------------------
set(PROJECT_NAME Sourcetrail)