rpm cpack debuginfo package generation getting warning "no source files were found!" and no debuginfo package

I have a problem with cpackrpm and have been banging my head against the wall for several days. I am on Centos 7.6 and using cmake/cpack 3.18.1. I can create a binary rpm, however, I keep getting “CPackRPM:Warning: debuginfo package was requested but will not be generated as no source files were found!” when I try to create a debuginfo package. With a small test project, I get a debuginfo package. However, with my production code I get the error. I have been trying to set CPACK_BUILD_SOURCE_DIRS with all combinations I can think of, to no avail, and I have not been able to see any examples of what it needs.
Not sure if this is relevant, but my CMAKE_BUILD_DIR is blank ("")

At the risk of stating the obvious, nobody here is going to be able to read your mind to determine how you’re trying to create the debuginfo package, so to get any help you’re probably going to need to show your code instead. Command lines, relevant snippets of CMakeLists.txt, cut-and-paste terminal sessions showing exactly what went in that led to the failure message coming out, etc.

According to the documentation:


For CMake project CPACK_BUILD_SOURCE_DIRS is set by default to point to CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR paths.

So if you’re using CMake, I wouldn’t expect it to need anything. You may be messing things up by trying to set it.

That’s probably fine, since CMAKE_BUILD_DIR means nothing, it’s not a supported CMake variable. Did you mean CMAKE_BINARY_DIR? (This is why showing actual code is helpful…)

This is the output that contains the error:

CPack: Create package using RPM
CPack: Install projects
CPack: - Run preinstall target for: BuickSim
CPack: - Install project: BuickSim []
CPack: Create package
CMake Warning (dev) at /usr/local/share/cmake-3.18/Modules/Internal/CPack/CPackRPM.cmake:1411 (message):
CPackRPM:Warning: debuginfo package was requested but will not be generated
as no source files were found!
Call Stack (most recent call first):
/usr/local/share/cmake-3.18/Modules/Internal/CPack/CPackRPM.cmake:1887 (cpack_rpm_generate_package)
This warning is for project developers. Use -Wno-dev to suppress it.

CPackRPM: Will use GENERATED spec file: /home/user/buick_framework/Software/Buick_cmake_build/_CPack_Packages/Linux/RPM/SPECS/Buicksim.spec
CPack: - package: /home/user/buick_framework/Software/Buick_cmake_build/BuickSim-1.2-Linux.rpm generated.

Here is the cpack statements I am using in my top-level CMakeLists.txt:

cmake_minimum_required(VERSION 3.18)

set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX /usr/src/debug/BCK/abcde)

I appreciate any help! Thanks