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

Allow consumption in subprojects #271

Merged

Conversation

Corristo
Copy link
Contributor

@Corristo Corristo commented Jan 6, 2021

Currently it is not possible to use git submodules and add_subfolder or FetchContent in a consuming CMake project to build Vc as part of the build of the consumer. This PR fixes the build issues and also adds an option to disable the installation, which is desirable when the consuming project is an application that links statically against Vc. Without that option the Vc headers and binaries are installed alongside the application even though they aren't needed.

When building Vc as a subproject of another CMake project, either
by including it as a git submodule or by using CMake's FetchContent,
the CMAKE_SOURCE_DIR variable does not point to the repository root.
Similary, the CMAKE_BINARY_DIR does no longer correspond to the
CMAKE_CURRENT_BINARY_DIR of the the top-level CMakeLists.txt file.

Using PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR instead guarantees
that additional files (e.g. the CMake Config template or custom modules)
are found correctly and that no files of the consuming project in
the CMAKE_BINARY_DIR are overwritten.
When including Vc as a subproject of another CMake project
(e.g. via FetchContent or git submodules) it might not
be necessary to not install Vc alongside the consuming project.

To allow consumers to decide whether they want to install Vc
or not this commit adds a new option Vc_ENABLE_INSTALL that
is ON by default.
@bernhardmgruber bernhardmgruber self-assigned this Jun 22, 2021
@bernhardmgruber bernhardmgruber added this to the Vc 1.4.3 milestone Jun 22, 2021
@bernhardmgruber bernhardmgruber merged commit 5824e56 into VcDevel:1.4 Jun 22, 2021
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