I'm having a problem with CPack but I don't quite understand what the problem is. In the installer.cmake file I have the following lines:
# ---------------------------------------------------------------------------------------
# set the variables for the call to CPack
SET(CPACK_PACKAGE_NAME "Kappa")
set(CPACK_NSIS_PACKAGE_NAME "Kappa")
set(CPACK_NSIS_DISPLAY_NAME "Kappa")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A great app.")
SET(CPACK_PACKAGE_DIRECTORY ${PACKAGING_DIR})
SET(CPACK_PACKAGE_VENDOR "Me")
SET(CPACK_PACKAGE_VERSION_MAJOR 19)
SET(CPACK_PACKAGE_VERSION_MINOR 2)
SET(CPACK_PACKAGE_VERSION_PATCH 12)
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/eula_licence.txt")
include(CPack)
When I run this code CPack fails with this warning:
EXEC : CPack error : Problem running NSIS command: "C:/Program Files (x86)/NSIS/makensis.exe" "D:/Workspace/Packaging/_CPack_Packages/win
64/NSIS/project.nsi" [D:\Workspace\build_fixed\package.vcxproj]
EXEC : CPack error : Problem compressing the directory [D:\Workspace\build_fixed\package.vcxproj]
EXEC : CPack error : Error when generating package: Kappa [D:\Workspace\build_fixed\package.vcxproj]
If I change the following lines as follows, it also throws the same error:
SET(CPACK_PACKAGE_VERSION_MAJOR "19")
SET(CPACK_PACKAGE_VERSION_MINOR "2")
SET(CPACK_PACKAGE_VERSION_PATCH "12")
However, if I change the following lines as below:
SET(CPACK_PACKAGE_VERSION_MAJOR "X")
SET(CPACK_PACKAGE_VERSION_MINOR "Y")
SET(CPACK_PACKAGE_VERSION_PATCH "Z")
then everything works and the package is compiled as Kappa-X-win64.exe.
I really don't understand why it can accept letters but not numbers or numbers as characters. I'm really confused by this. I can obviously just leave it with the XYZ but I'd like to understand what is going on.
I'm sure it's probably a simple error but I'm just starting out with CMake and CPack and this seems silly.
Further Info
I've tried quite a few other combinations and even just setting the X in CPACK_PACKAGE_VERSION_MAJOR to 19 is enough to break things.
I've had a look at the generated CPackSourceConfig.cmake file and can see the following lines:
set(CPACK_PACKAGE_FILE_NAME "Kappa-19-Source")
set(CPACK_PACKAGE_NAME "Kappa")
set(CPACK_PACKAGE_VERSION "19")
set(CPACK_PACKAGE_VERSION_MAJOR "19")
set(CPACK_PACKAGE_VERSION_MINOR "Y")
set(CPACK_PACKAGE_VERSION_PATCH "Z")
I don't know where the "source" came from and assume it should be the win64 part but it's all not making much sense as to why I can't use a number. Looking inside the NSIS folder I can see that all the files have been assembled into a "Kappa-19-win64" folder, but it just seems to fail at the point of creating the compressed .exe.
Update
I've managed to break CPack in a new way - even with the "XYZ" strings that were working it now fails to build. What I've changed was some packages in the miniconda environment that was being packed in the installer.
The installer now fails at the following section in the project.nsi file:
Section "miniconda" miniconda
SetOutPath "$INSTDIR"
File /r "${INST_DIR}\miniconda\*.*"
SectionEnd
Specifically the File /r ... line.
Does anyone know why something in miniconda distribution could break CPack?