I am trying to use cpack with cmake and nsis to generate an installer which add the .exe files generated to the environment variable.
I have a main cmakelist.txt
in which I add subdirectory with add_subdirectory(
each subdirectory has a cmakelist.txt.
in the main subdirectory at the end for now I added:
SET(CPACK_NSIS_MODIFY_PATH ON)
SET(CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION OFF)
INCLUDE(CPack)
and in each "sub"cmakelist.txt
I added :
SET(CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION OFF)
INCLUDE(CPack)
I have this error:
CPack: Create package using NSIS CPack: Install projects CPack: - Install project: MIALSRTK CMake Error at D:... ABSOLUTE path INSTALL DESTINATION forbidden (by caller):
(this is why I tried: SET(CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION OFF) but it hasn't change anything). I tried to run as administrator as well.
I also tried the solution here: CPack NSIS, generate installer for Windows
but if(pack) doesn't seem to works. it goes into the else(pack) part (i used the command message to see where it goes).
Do you have any idea on how to solve this problem ?