I am porting our product from using Makefiles to CMAKE. With Makefile we have 'install' target to move stuff to some location on user's machine and 'deploy' - to some fixed location on a server. I don't want to run 'cmake -DCMAKE_INSTALL_PREFIX=...' to reconfigure each time I need to switch a destination and prefer to minimize extra typing on a command line. Therefore, in my CMakeLists, I have
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/../../_install)
Now, I am trying to use 'add_custom_target' but not sure how to do this correctly:
add_custom_target(DEPLOY
COMMAND "${CMAKE_COMMAND}" --build . --target install --install ${SITE}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
Any idea?