Skip to content

fix: Fix thread issue in CMakeLists for Android#6

Open
ajeetsinghyadav wants to merge 1 commit intomainfrom
VNE_LOGGING_PTHREAD_FIX_2
Open

fix: Fix thread issue in CMakeLists for Android#6
ajeetsinghyadav wants to merge 1 commit intomainfrom
VNE_LOGGING_PTHREAD_FIX_2

Conversation

@ajeetsinghyadav
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 8, 2026 02:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a missing find_package(Threads REQUIRED) call in src/CMakeLists.txt that was causing a CMake configuration error on Android (and potentially other non-Windows/non-Emscripten platforms) when src/CMakeLists.txt was processed without the necessary Threads package being available. It also updates the comment on the platform-specific linking block for clarity.

Changes:

  • Added find_package(Threads REQUIRED) inside the if(NOT WIN32 AND NOT EMSCRIPTEN) guard in src/CMakeLists.txt.
  • Updated the inline comment to say "portable across toolchains" instead of "portable for pthread".

# Platform-specific library linking (Threads::Threads is portable for pthread)
# Platform-specific library linking (Threads::Threads is portable across toolchains)
if(NOT WIN32 AND NOT EMSCRIPTEN)
find_package(Threads REQUIRED)
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

The find_package(Threads REQUIRED) call added here is redundant. The root CMakeLists.txt already calls find_package(Threads REQUIRED) unconditionally at line 250, immediately before add_subdirectory(src). Because src/CMakeLists.txt is always processed via that add_subdirectory, the Threads package is guaranteed to be found before this file is evaluated.

Additionally, placing find_package inside a platform-conditional block (if(NOT WIN32 AND NOT EMSCRIPTEN)) is a subtle inconsistency: the find call is now skipped on Windows/Emscripten, while the root always finds it. If this block is the authoritative location for the find_package call in the future (e.g., if the root-level call is removed), Windows and Emscripten builds would silently skip finding Threads, which could cause issues if Threads::Threads is ever referenced elsewhere from this file.

The find_package(Threads REQUIRED) should be removed from src/CMakeLists.txt, since the root CMakeLists.txt already handles it. If src/CMakeLists.txt must remain self-contained, the find_package should be placed unconditionally at the top of the file, not nested inside the platform guard.

Suggested change
find_package(Threads REQUIRED)

Copilot uses AI. Check for mistakes.
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.

2 participants