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

[cmake] Fix handling of BUILD_SHARED_LIBS option #201

Merged
merged 2 commits into from
Oct 16, 2022

Conversation

p12tic
Copy link
Contributor

@p12tic p12tic commented Oct 15, 2022

BUILD_SHARED_LIBS option is declared conditionally on whether BUILD_SHARED_LIBS is defined itself. This is problematic as multiple invocations of a build runner such as ninja will cause builds to use different options. The first build will run as if BUILD_SHARED_LIBS is not defined (i.e. OFF option), the second time cmake will notice that BUILD_SHARED_LIBS was defined after all and now run build with BUILD_SHARED_LIBS set to ON. This is confusing and error prone.

To fix the problem, a top-level BUILD_SHARED_LIBS option has been added and BUILD_SHARED_LIBS option in applications subdirectory was changed to become active only if the project is standalone.

@p12tic
Copy link
Contributor Author

p12tic commented Oct 15, 2022

Build fails because it does not find tbb.

@simogasp simogasp added this to the v1.0.3 milestone Oct 15, 2022
@simogasp
Copy link
Member

I merged the other PR. I think you need to rebase with developing so that the CI is up-to-date with the new docker image used.

BUILD_SHARED_LIBS option is declared conditionally on whether
BUILD_SHARED_LIBS is defined itself. This is problematic as multiple
invocations of a build runner such as ninja will cause builds to use
different options. The first build will run as if BUILD_SHARED_LIBS is
not defined (i.e. OFF option), the second time cmake will notice that
BUILD_SHARED_LIBS was defined after all and now run build with
BUILD_SHARED_LIBS set to ON. This is confusing and error prone.

To fix the problem, a top-level BUILD_SHARED_LIBS option has been added
and BUILD_SHARED_LIBS option in applications subdirectory was changed to
become active only if the project is standalone.
@p12tic p12tic force-pushed the fix-build-shared-libs-option branch from c0ff2b1 to 7ed4124 Compare October 16, 2022 14:21
@p12tic
Copy link
Contributor Author

p12tic commented Oct 16, 2022

@simogasp Rebased, thanks.

Copy link
Member

@simogasp simogasp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@simogasp simogasp merged commit d0ff459 into alicevision:develop Oct 16, 2022
@p12tic p12tic deleted the fix-build-shared-libs-option branch October 16, 2022 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants