Skip to content

Commit

Permalink
CMake: remove broken logic to install empty database directory
Browse files Browse the repository at this point in the history
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: #1142
  • Loading branch information
micahsnyder committed Jan 22, 2024
1 parent c48146a commit f0e5337
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions freshclam/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down

0 comments on commit f0e5337

Please sign in to comment.