From f0e5337e4bdf3379dbd6923367f9d4c4681ef551 Mon Sep 17 00:00:00 2001 From: Micah Snyder Date: Tue, 16 Jan 2024 15:16:25 -0500 Subject: [PATCH] CMake: remove broken logic to install empty database directory The CMake code to install the empty database directory doesn't appear to do anything. Further, it is causing build issues for some users. I tested some with trying to install the database directory directly, like this: ```cmake if(IS_ABSOLUTE ${DATABASE_DIRECTORY}) INSTALL(DIRECTORY DESTINATION $ENV{DESTDIR}${DATABASE_DIRECTORY} COMPONENT programs) else() INSTALL(DIRECTORY DESTINATION $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${DATABASE_DIRECTORY} COMPONENT programs) endif() ``` However, this causes build failures for Windows and macOS installers. Windows: ``` CMake Error at C:/Users/build/Documents/jenkins/workspace/test-pipelines_build-1.3/clamav-devel/build64/freshclam/cmake_install.cmake:66 (message): ABSOLUTE path INSTALL DESTINATION forbidden (by caller): C:/Users/build/Documents/jenkins/workspace/test-pipelines_build-1.3/clamav-devel/build64/install/database/ Call Stack (most recent call first): C:/Users/build/Documents/jenkins/workspace/test-pipelines_build-1.3/clamav-devel/build64/cmake_install.cmake:133 (include) ``` macOS: ``` CMake Error at /Users/****/jenkins/workspace/test-pipelines_build-1.3/clamav-devel/build-pkg/freshclam/cmake_install.cmake:111 (file): file INSTALL cannot make directory "/usr/local/clamav/share/clamav": No such file or directory. Call Stack (most recent call first): /Users/****/jenkins/workspace/test-pipelines_build-1.3/clamav-devel/build-pkg/cmake_install.cmake:122 (include) CPack Error: Error when generating package: ClamAV ``` I think my best option is just to remove this line of code since it's causing problems for some and isn't working for anyone. Even if it would be nice to have the database directory created at install time automatically. Fixes: https://github.com/Cisco-Talos/clamav/issues/1142 --- freshclam/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/freshclam/CMakeLists.txt b/freshclam/CMakeLists.txt index ef3616fe32..2e77a87403 100644 --- a/freshclam/CMakeLists.txt +++ b/freshclam/CMakeLists.txt @@ -46,9 +46,6 @@ else() install(TARGETS freshclam-bin DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT programs) endif() -# Install an empty database directory -INSTALL(CODE "FILE(MAKE_DIRECTORY \${ENV}\${CMAKE_INSTALL_PREFIX}/\${DATABASE_DIRECTORY})" COMPONENT programs) - # Now we rename freshclam-bin executable to freshclam using target properties set_target_properties( freshclam-bin PROPERTIES OUTPUT_NAME freshclam )