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

Only build tests when libdivide is the main project #110

Merged
merged 1 commit into from
Dec 9, 2023
Merged

Only build tests when libdivide is the main project #110

merged 1 commit into from
Dec 9, 2023

Conversation

qak
Copy link
Collaborator

@qak qak commented Dec 4, 2023

This pull request configures the LIBDIVIDE_BUILD_TESTS CMake option to be ON only when libdivide is being configured as the main project. This is because building tests by default when libdivide is not the main project can unexpectedly include libdivide's tests into the main project's tests. The fix in this pull request is inspired by an analogous fix in another C++ library here.

The issue can be explained as follows. When a user includes libdivide into their CMake project using FetchContent, CMake fully configures and builds libdivide during the main project's configuration phase and includes libdivide into the main project using add_subdirectory. The unexpected consequence is that libdivide's tests get added into the main project's tests that get run using the ctest command. Configuring the LIBDIVIDE_BUILD_TESTS option to be OFF when libdivide is not the main project prevents libdivide's tests from being added into the main project when the user doesn't expect so, but it let's them manually add libdivide's tests if they desire by toggling the LIBDIVIDE_BUILD_TESTS option.

Let the LIBDIVIDE_BUILD_TESTS option be enabled by default only when
libdivide is being configured as the main project.
@qak qak merged commit ee2a872 into ridiculousfish:master Dec 9, 2023
1 check failed
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

Successfully merging this pull request may close these issues.

1 participant