Is there a way to disable the INSTALL target in Visual Studio while still generating the cmake_install.cmake for CPack? (Feature request?)

Hello.

I think it’s a relatively popular case on Windows when the install(…) command in a project is used only in conjunction with CPack – to create an installer. In such cases the INSTALL predefined target by itself is typically unable to install the project properly (especially when additional steps like addon/service registration are required) and therefore isn’t used.

There’s a CMAKE_SKIP_INSTALL_RULES variable, however it prevents the cmake_install.cmake file from being generated at all (at least by usual means) and therefore breaks the creation of an installer (unless cmake_install.cmake is created by some other means a-la file(WRITE cmake_install.cmake …) or the installer itself is created by some alternative means a-la add_custom_command(… COMMAND makensis …)).

Is there way to just hide the INSTALL predefined target from Visual Studio but not disable the cmake_install.cmake generation? (Or, maybe, if we extend it to other platforms: to disable install target generation but not the cmake_install.cmake file generation.) Maybe I should create a feature request for that?

Thanks.

1 Like