[Capnp] Move the minimum CMake version logic to only run if capnp is found (#5335)

This commit is contained in:
John Demme 2023-06-07 16:47:15 -07:00 committed by GitHub
parent c7621079f3
commit 71fd2dc84e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 11 deletions

View File

@ -413,17 +413,6 @@ option(CAPNP_DISABLE "Disable Cap'nProto (needed for cosimulation).")
if (CAPNP_DISABLE)
message (STATUS "Disabling Cap'nProto.")
else()
# Some of our CMake code which is only used in Capnp builds uses newer CMake
# features. Since most compilations are not capnp builds, only require the new
# version for those builds.
if(CMAKE_VERSION VERSION_LESS "3.23.0")
message(SEND_ERROR
"Building CIRCT with Cap'nProto features enabled uses CMake features "
"that require at least version 3.23. Recommend upgrading to 3.23+ "
"for full support. Detected current version: ${CMAKE_VERSION}. If you "
"do not need ESI cosim features, you can use the CAPNP_DISABLE option.")
endif()
if(DEFINED CAPNP_PATH)
set(ENV{PKG_CONFIG_PATH}
"${CAPNP_PATH}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
@ -438,6 +427,17 @@ else()
message(STATUS "Found Cap'nProto at ${CapnProto_DIR}.")
set(CMAKE_INSTALL_RPATH ${capnp_LIBDIR})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Some of our CMake code which is only used in Capnp builds uses newer CMake
# features. Since most compilations are not capnp builds, only require the
# new version for those builds.
if(CMAKE_VERSION VERSION_LESS "3.23.0")
message(SEND_ERROR
"Building CIRCT with Cap'nProto features enabled uses CMake features "
"that require at least version 3.23. Recommend upgrading to 3.23+ "
"for full support. Detected current version: ${CMAKE_VERSION}. If you "
"do not need ESI cosim features, you can use the CAPNP_DISABLE option.")
endif()
endif()
endif()