[libclc] [llvm] [libclc] Refactor build system to allow in-tree builds (PR #87622)

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 21 13:36:44 PDT 2024


================
@@ -167,12 +181,14 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libclc.pc DESTINATION "${CMAKE_INSTAL
 install( DIRECTORY generic/include/clc DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" )
 
 if( ENABLE_RUNTIME_SUBNORMAL )
-  add_library( subnormal_use_default STATIC
-    generic/lib/subnormal_use_default.ll )
-  add_library( subnormal_disable STATIC
-    generic/lib/subnormal_disable.ll )
-  install( TARGETS subnormal_use_default subnormal_disable ARCHIVE
-    DESTINATION "${CMAKE_INSTALL_DATADIR}/clc" )
+  foreach( file subnormal_use_default subnormal_disable )
+    link_bc(
+       TARGET ${file}
+       INPUTS ${PROJECT_SOURCE_DIR}/generic/lib/${file}.ll
+    )
+    install( FILES $<TARGET_PROPERTY:${file},TARGET_FILE> ARCHIVE
----------------
aaronpuchert wrote:

This causes an installation error for me with `-DENABLE_RUNTIME_SUBNORMAL:BOOL=ON`:
```
CMake Error at cmake_install.cmake:54 (file):
  file INSTALL cannot find
  "[...]/ARCHIVE": No such file or directory.
```
According to the [documentation](https://cmake.org/cmake/help/latest/command/install.html), `ARCHIVE` is a valid option for `install(TARGETS ...)`, but not for `install(FILES ...)`.

https://github.com/llvm/llvm-project/pull/87622


More information about the cfe-commits mailing list