[CMake] Fix install failure with CMAKE_SLANG_FRONTEND_ENABLED enabled (#7437)

Slang compiler relies on the third-party libraries like unordered_dense and fmt
library. The fmt library provides two ways to integrated it:
  1.Headers-only
  2.Seperately compiled
The main purpose of this commit is to avoid installation failure of CIRCT project due
to finding fmt header file in wrong path which is in circt `include` directory when
CMake_slang_Frontend_enabled is turned on. We hope to not install header files coming
from fmt library.
This commit is contained in:
cepheus 2024-08-06 11:29:30 +08:00 committed by GitHub
parent b35bc81fc0
commit 930aabe70f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -591,6 +591,13 @@ if(CIRCT_SLANG_FRONTEND_ENABLED)
# harder than it ought to be. # harder than it ought to be.
set_property( set_property(
GLOBAL APPEND PROPERTY CIRCT_EXPORTS slang_slang unordered_dense fmt) GLOBAL APPEND PROPERTY CIRCT_EXPORTS slang_slang unordered_dense fmt)
# Disable the installation of headers coming from third-party libraries. We
# won't use those APIs directly. Just make them static libraries for the sake
# of running slang normally.
set_target_properties(fmt PROPERTIES PUBLIC_HEADER "")
set_target_properties(unordered_dense PROPERTIES PUBLIC_HEADER "")
install(TARGETS slang_slang unordered_dense fmt EXPORT CIRCTTargets) install(TARGETS slang_slang unordered_dense fmt EXPORT CIRCTTargets)
else() else()
find_package(slang 3.0 REQUIRED) find_package(slang 3.0 REQUIRED)