Add support for compiler launcher using buildcache

Use CMAKE_CXX_COMPILER_LAUNCHER if buildcache is found in path
This commit is contained in:
Magne Sjaastad 2020-05-07 07:58:18 +02:00
parent a1eb707b02
commit e3115bfef9

View File

@ -1,5 +1,18 @@
cmake_minimum_required (VERSION 2.8.12)
################################################################################
# buildcache
#
# buildcache will be used if found in path
################################################################################
find_program(buildcache_program buildcache)
if(buildcache_program)
set(CMAKE_CXX_COMPILER_LAUNCHER "${buildcache_program}")
message( STATUS "Found buildcache from : ${buildcache_program}" )
else()
message( STATUS "No buildcache found" )
endif()
include (CheckCSourceCompiles)
project (ResInsight)
@ -91,6 +104,11 @@ include(cafCotireTools)
# ERT
################################################################################
# Use of CMAKE_CXX_COMPILER_LAUNCHER is not working with libecl. Disable by temporarily setting
# compiler launcher to nothing
set(TEMP_CMAKE_CXX_COMPILER_LAUNCHER ${CMAKE_CXX_COMPILER_LAUNCHER})
set(CMAKE_CXX_COMPILER_LAUNCHER)
if (NOT MSVC)
# Linux: Optional configuration of externally installed ERT, requires path to libraries and includes
set(RESINSIGHT_ERT_EXTERNAL_LIB_ROOT "" CACHE PATH "Path to installed ERT libraries")
@ -160,6 +178,9 @@ else()
endif(RESINSIGHT_ERT_EXTERNAL_LIB_ROOT OR RESINSIGHT_ERT_EXTERNAL_INCLUDE_ROOT)
# restore buildcache when libecl has been configured
set(CMAKE_CXX_COMPILER_LAUNCHER ${TEMP_CMAKE_CXX_COMPILER_LAUNCHER})
###############################################
# Init GIT submodules if they haven't already #
###############################################