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

[Refactor] Separate Build and Test in CMake #31

Closed
5 tasks
pedrobiqua opened this issue Jan 5, 2025 · 0 comments · Fixed by #32
Closed
5 tasks

[Refactor] Separate Build and Test in CMake #31

pedrobiqua opened this issue Jan 5, 2025 · 0 comments · Fixed by #32
Assignees
Labels
enhancement New feature or request refactor

Comments

@pedrobiqua
Copy link
Collaborator

🎯 Reason for Refactoring

The current CMake setup mixes the build process with test execution, making the codebase less modular and harder to maintain. By refactoring, we aim to separate the build and test functionalities to improve organization, readability, and maintainability.


🔍 Current Code Description

  • The current implementation combines the build and test logic within a single CMakeLists.txt file.
  • Test targets (add_test) are defined alongside build targets, which makes it harder to manage and scale the project.
  • There is no clear distinction between the code required for building the project and the code dedicated to testing.

✅ Proposed Solution

  1. Create a dedicated tests/CMakeLists.txt file to handle all test-related targets and configurations.
  2. Include the tests/CMakeLists.txt in the root CMakeLists.txt using add_subdirectory.
  3. Separate test dependencies from build dependencies, ensuring clarity in the configuration.
  4. Maintain a modular structure where the build system and test system can evolve independently.

📈 Expected Impact

  • Improve project organization by clearly separating build and test logic.
  • Make the project more modular, simplifying future feature additions and changes.
  • Facilitate easier debugging and faster iteration during the testing process.
  • Enhance collaboration among team members by providing a clearer structure.

🛠️ Completion Checklist

  • Create a tests/CMakeLists.txt file and move all test-related configurations there.
  • Update the root CMakeLists.txt to include the test directory using add_subdirectory.
  • Verify that all build targets remain functional after refactoring.
  • Ensure all tests run as expected after the refactor.
  • Update documentation to reflect the new project structure.

📂 Related References


💡 Additional Notes

This refactoring will make it easier to add new test suites or extend the testing framework in the future. Additionally, this separation aligns with industry best practices and prepares the project for potential CI/CD pipeline improvements.

@pedrobiqua pedrobiqua added enhancement New feature or request refactor labels Jan 5, 2025
@pedrobiqua pedrobiqua self-assigned this Jan 5, 2025
@pedrobiqua pedrobiqua linked a pull request Jan 5, 2025 that will close this issue
16 tasks
@pedrobiqua pedrobiqua mentioned this issue Jan 5, 2025
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant