CPackRPM: Cannot package an app in a folder with ++ in the name
CPackRPM passes a path into a regex match without escaping here.
The regex fails to compile when there is a ++
in the name of the folder.
$ make package
Scanning dependencies of target lib
[ 50%] Building C object CMakeFiles/lib.dir/lib.c.o
[100%] Linking C shared library liblib.so
[100%] Built target lib
Run CPack packaging tool...
CPack: Create package using RPM
CPack: Install projects
CPack: - Run preinstall target for: Project
CPack: - Install project: Project
CPack: Create package
RegularExpression::compile(): Nested *?+.
RegularExpression::compile(): Error in compile.
CMake Error at /usr/share/cmake/Modules/CPackRPM.cmake:1439 (if):
if given arguments:
"SYMLINK_POINT_" "MATCHES" "/home/USER/Development/bug++/build/_CPack_Packages/Linux/RPM/Project-0.1.1-Linux/.*"
Regular expression
"/home/USER/Development/bug++/build/_CPack_Packages/Linux/RPM/Project-0.1.1-Linux/.*"
cannot compile
Call Stack (most recent call first):
/usr/share/cmake/Modules/CPackRPM.cmake:2365 (cpack_rpm_prepare_install_files)
/usr/share/cmake/Modules/CPackRPM.cmake:2824 (cpack_rpm_generate_package)
CPack Error: Error while execution CPackRPM.cmake
CPack Error: Problem compressing the directory
CPack Error: Error when generating package: Project
make: *** [Makefile:98: package] Error 1
e.g.
$ tree
.
└── bug++
├── CMakeLists.txt
├── lib.c
└── lib.h
2 directories, 3 files
$ cat bug++/CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
set(BUILD_SHARED_LIBS On)
add_library(lib lib.c)
set_target_properties(lib PROPERTIES
SOVERSION 56
)
install(TARGETS lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
set(CPACK_GENERATOR "RPM")
include(CPack)
$ cat bug++/lib.c
#include "lib.h"
int foo()
{
return 2;
}
$ cat bug++/lib.h
int foo();