smanders / externpro

build external projects with cmake
MIT License
13 stars 12 forks source link

Allow INSTALL and PACKAGE to be built using a keyboard shortcut #386

Closed Triasmus closed 1 year ago

Triasmus commented 1 year ago

I have a VS extension called Build Only Startup Project for assigning a keyboard shortcut that will build the startup project instead of whatever project I'm currently editing. I like to have INSTALL set as my startup project.

Currently, it does not work to try to build INSTALL with the hotkey: image

For that hotkey to work, this box has to be checked: image

With that box checked, the build works properly: image

ALL_BUILD and ZERO_CHECK are already enabled, but INSTALL, PACKAGE, and RUN_TESTS are not enabled. It seems that RUN_TESTS can't be enabled through cmake and the others need to be enabled with these commands (well, they can be enabled manually, but that's no fun. And rerunning cmake will disable them.)

This location made the most sense to me as the proper spot to add these settings, which is why I put them here.

smanders commented 1 year ago

cmake docs

smanders commented 1 year ago

one thing about this change that I'm not sure I like: INSTALL and PACKAGE now are part of the "Build Solution" -- in other words, they are built every time you build the solution -- and this makes Windows different than Linux where make install and make package are separate from make -- I think I would prefer that we keep things the same on both platforms, by default: install and package are separate steps

what I'm considering doing, however, is wrapping this in a cmake option (perhaps XP_BUILD_INSTALL_PACKAGE) that is OFF by default, but allows a user to set this option (cmake -DXP_BUILD_INSTALL_PACKAGE=ON /path/to/src) to set the two variables: CMAKE_VS_INCLUDE_[INSTALL|PACKAGE]_TO_DEFAULT_BUILD

thoughts @Triasmus?

Triasmus commented 1 year ago

@smanders That sounds fine to me. It would allow me the check the box in the cmake gui and it wouldn't undo that setting every time I rebuild.

I was worried that there might be an unforeseen side effect with those settings, but I always build through Visual Studio so I would never have noticed it. Sorry.