[CMake] Add file copy command for API modules (#8414)

In the current version of CIRCT, the module files in `cmake/modules` are
not copied to `CIRCT_CMAKE_DIR`, which causes issues for out-of-tree
external projects that depend on CIRCT. This patch ensures that the 
files in `cmake/modules` are copied into `CIRCT_CMAKE_DIR`.
This commit is contained in:
Chia-Hsuan Lin 2025-04-19 05:47:07 +08:00 committed by GitHub
parent c5ce67e79a
commit e615646678
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 0 deletions

View File

@ -49,6 +49,17 @@ set(CIRCT_CONFIG_TOOLS_DIR)
set(CIRCT_CONFIG_INCLUDE_EXPORTS)
set(CIRCT_CONFIG_INCLUDE_DIRS)
# For compatibility with projects that add '<build>/lib/cmake/circt' to
# their CMAKE_MODULE_PATH, place API modules next to it.
# Copy without source permissions because the source could be read-only,
# but we need to write into the copied folder.
file(COPY .
DESTINATION ${circt_cmake_builddir}
NO_SOURCE_PERMISSIONS
FILES_MATCHING PATTERN *.cmake
PATTERN CMakeFiles EXCLUDE
)
# Generate CIRCTConfig.cmake for the install tree.
set(CIRCT_CONFIG_CODE "
# Compute the installation prefix from this CIRCTConfig.cmake file location.