OpenBluetoothToolbox / SimpleBLE

SimpleBLE - the all-in-one Bluetooth library for MacOS, iOS, Windows, Linux and Android.
https://www.simpleble.org
Other
655 stars 110 forks source link

Make install targets optional in CMake #266

Closed arludwig closed 1 month ago

arludwig commented 10 months ago

I am integrating SimpleBLE in a project as submodule, to be compiled and built along with the project's code. I also use install rules for my project.

Now I have the problem, that SimpleBLE's install rules are also added and executed, which is not what I want or need. Many projects offer some sort of option to disable install rules. For SimpleBLE this could look like

option(INSTALL_SimpleBLE "Disable installing" ON)

that can be set before including

set(INSTALL_SimpleBLE OFF)
add_subdirectory("SimpleBLE/simpleble")

My current workaround is to use the EXCLUDE_FROM_ALL flag for add_subdirectory()

add_subdirectory("SimpleBLE/simpleble" EXCLUDE_FROM_ALL)

which works fine for me. But technically it does way more than just disabling installs, so I think it would be nice for SimpleBLE to offer such option.

kdewald commented 1 month ago

add_subdirectory("SimpleBLE/simpleble" EXCLUDE_FROM_ALL) is the correct way to deal with this problem. What functionality is missing by doing this?