mirror of
https://github.com/verilator/verilator.git
synced 2024-12-29 10:47:34 +00:00
Support ccache when compiling Verilator with CMake (#4678)
This commit is contained in:
parent
ab06ace1f6
commit
6566e853cd
@ -48,6 +48,27 @@ if (WIN32)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
endif()
|
||||
|
||||
set(OBJCACHE "" CACHE STRING "Path for ccache, auto-detected if empty")
|
||||
option(OBJCACHE_ENABLED "Compile Verilator with ccache" ON)
|
||||
|
||||
if (OBJCACHE_ENABLED)
|
||||
if (OBJCACHE STREQUAL "")
|
||||
find_program(OBJCACHE_PATH ccache)
|
||||
if (OBJCACHE_PATH STREQUAL "OBJCACHE_PATH-NOTFOUND")
|
||||
set(OBJCACHE_PATH "")
|
||||
endif()
|
||||
else()
|
||||
set(OBJCACHE_PATH "${OBJCACHE}")
|
||||
endif()
|
||||
if (NOT OBJCACHE_PATH STREQUAL "")
|
||||
execute_process(COMMAND "${OBJCACHE_PATH}" --version
|
||||
OUTPUT_VARIABLE objcache_version)
|
||||
string(REGEX MATCH "[^\n\r]+" objcache_version "${objcache_version}")
|
||||
message(STATUS "Found ccache: ${OBJCACHE_PATH} (\"${objcache_version}\")")
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER "${OBJCACHE_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(BISON)
|
||||
find_package(FLEX)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user