Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give user control of which dependency should be enabled #45

Open
traversaro opened this issue Jan 30, 2021 · 0 comments
Open

Give user control of which dependency should be enabled #45

traversaro opened this issue Jan 30, 2021 · 0 comments

Comments

@traversaro
Copy link
Member

I noticed that in blocktest the scriptbuilder tool is silently not build if Qt5 is not found, while it is always enabled if Qt5 is found.

While this behavior make sense as a default behavior, from the point of view of packaging it may not be ideal. For example in the robotology-superbuild, it we want the blocktest to built scriptbuilder, we want to get a clear error if Qt5 is not found, instead of silently disabling the compilation of scriptbuilder. See https://www.youtube.com/watch?t=654 for more details.

A good tradeoff to maintain the current behaviour while giving to packagers the possibility of explicitly specifying if Qt5 should used or not is the following:

find_package(Qt5 QUIET COMPONENTS Core Gui Widgets)
option(BLOCKTEST_USES_Qt5 ${Qt5_FOUND})
if(BLOCKTEST_USES_Qt5)
  find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets)
endif()

In this way, the default behavior remains the same, but if I explicitly set the BLOCKTEST_USES_Qt5 option to ON, the build fails if Qt5 is not found. See https://github.com/robotology/idyntree/blob/v2.0.2/cmake/iDynTreeDependencies.cmake#L46 for an example of such usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant