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 and Code Improvements #1

Open
yazdanbhd opened this issue Aug 19, 2024 · 1 comment
Open

CMake and Code Improvements #1

yazdanbhd opened this issue Aug 19, 2024 · 1 comment

Comments

@yazdanbhd
Copy link

There are several areas in the project that could benefit from enhancements in both the CMake setup and the code itself. Below are the suggested improvements:

CMake Improvements

  1. Specify C++ version:

    • Explicitly set the C++ standard in your CMakeLists.txt file.
  2. Modernize package finding:

    • Replace pkg_check_modules with find_package or use PkgConfig:: imported targets.
    • Update your linking command to:
      target_link_libraries(${PROJECT_NAME} PRIVATE libcurl PkgConfig::GTKMM)
  3. Explicit source file listing:

    • Replace file(GLOB) with explicit listing of source files to ensure CMake picks up new files correctly.
  4. Cross-platform support:

    • Enhance CMake configuration to handle macOS and Windows platforms in addition to Linux.
  5. Proper c-ares integration:

    • Use FetchContent to include c-ares since libcurl uses it when ENABLE_ARES is set to ON.

Code Improvements

  1. Replace NULL with nullptr:

    • Use nullptr instead of NULL throughout the codebase for improved type safety.
  2. RAII for CURL handle:

    • Wrap CURL handle in a smart pointer or custom RAII class for exception safety.
  3. Use static_cast:

    • Replace C-style casts with static_cast for improved type safety.
  4. Utilize smart pointers:

    • Implement smart pointers for dynamically allocated objects to ensure automatic resource cleanup and exception safety.
@Saman-Safaei-Dev
Copy link
Collaborator

Thanks for opening this issue.
I applied the CMake Improvements on the project. Can you open a pull request and apply Code Improvements to the updated source code?

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

2 participants