ericniebler / range-v3

Range library for C++14/17/20, basis for C++20's std::ranges
Other
4.06k stars 437 forks source link

Don't install Range-v3 when it is used as a subproject #1761

Closed Attractadore closed 1 year ago

Attractadore commented 1 year ago

IMHO installing a subproject with the main project is undesirable, so this patch addresses this issue.

loicmouton commented 1 year ago

Hello, After this change I have the following error when using FetchContent to integrate range-v3 into my project : CMake Error: install(EXPORT "myProjectTargets" ...) includes target "myTarget" which requires target "range-v3" that is not in any export set..

I believe this is due to the introduction of the RANGE_V3_INSTALL as an option dependent on "is_standalone". I believe that this is a great option to have but I also believe it should be a "simple" option that it always available. If it were a "simple" option, I could simply override its value in my CMake project like I usually do for most CMake libraries I use : set("RANGE_V3_INSTALL" ON CACHE BOOL "Enable install rule for range-v3" FORCE) (before the call to FetchContent).

Furthermore, the same is true for RANGE_V3_TESTS and RANGE_V3_EXAMPLES and, although I have yet no interest in enabling them, someone might want to enable them even if range-v3 is a sub-project.