I made an installer for my software using cmake and cpack.
in the cpack installer the user chose where to install the software.
let's say C:\Users\MySoftware
all my .exe
and a python
file go in it using the Destination option of cmake
.
using cpack
, it adds C:\Users\MySoftware
to my environment variable.
then all my .exe are usable from the window cmd
.
I have a .bat
which run the multiple .exe
in some order with some options etc ...
and in the middle of it, it runs a python script.
python C:\HardPATH/mypython.py -i %var1% -m %var2% -t %var3% -o %var4% -I %var5% .
I am trying to modify C:\HardPath when using cmake or cpack
My problem is that I don't find a way to edit "HardPATH" using cmake
or cpack
, according to where the user choose to install the software.
and because it's a .py
and not .exe
, even if it's in the folder added to the env path it doesn't work.
I tried using configure_file
but it's executed to soon, at configure step, so before the user choose the "HardPATH" using cpack installer. maybe something is possible using add_custom_command
? but I don't get how to change the hardPATH in the .bat using this command, or if it's possible.
Any idea how i could solve this "HardPATH" problem ?
IF(CMAKE_SYSTEM_NAME STREQUAL Windows)
IF(Pack)
INSTALL(TARGETS
exe1
exe2
etc
DESTINATION bin)
find_program(PYTHON "python")
if (PYTHON)
INSTALL(FILES mypython.py DESTINATION bin)
endif()
ELSE(Pack)
INSTALL(TARGETS
exe1
exe2
etc
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
find_program(PYTHON "python")
if (PYTHON)
INSTALL(FILES mypython.py DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
endif()
ENDIF(Pack)
ENDIF(CMAKE_SYSTEM_NAME STREQUAL Windows)
and to add the path in the env variable, in the main cmakelist calling this one, I have:
set(CPACK_PACKAGE_NAME "CPackExampleInstaller")
SET(CPACK_NSIS_MODIFY_PATH ON)
INCLUDE(CPack)
if I type echo %PATH%
I see where I chose to install mysoftware in it.
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9. 0\libnvvp;C:\Python36\Scripts\;C:\Python36\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Pro gram Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\CMake\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\m ingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\xxx\Desktop\testCode\bin;;C:\Users\xxxx\AppData\Local\GitHubDesktop\bin;D:\xxxx\Docker Toolbox
and i can call the .exe within C:\Users\xxx\Desktop\testCode\bin without typing the full path. but not the python