Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dcc-network/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set(PLUGIN_NAME "dcc-network-plugin")

project(${PLUGIN_NAME})

set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_PTHREADS_INIT 1)
set(CMAKE_PREFER_PTHREAD_FLAG ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
Expand Down
5 changes: 5 additions & 0 deletions dock-network-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ file(GLOB_RECURSE SRCS
"widget/commoniconbutton.cpp"
)

set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_PTHREADS_INIT 1)
set(CMAKE_PREFER_PTHREAD_FLAG ON)

find_package(${QT_NS} COMPONENTS Core Widgets DBus Network LinguistTools REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(${DTK_NS} REQUIRED COMPONENTS Widget)
Expand Down
5 changes: 5 additions & 0 deletions dss-network-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ set(NET_USE_NOTIFICATION ON)

file(GLOB_RECURSE SRCS "networkmodule.h" "networkmodule.cpp" "../net-view/*.h" "../net-view/*.cpp")

set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_PTHREADS_INIT 1)
set(CMAKE_PREFER_PTHREAD_FLAG ON)

find_package(Qt6 COMPONENTS Core Widgets DBus Network LinguistTools REQUIRED)
find_package(PkgConfig REQUIRED)
# find_package(Qt5Svg REQUIRED)
Expand Down
6 changes: 6 additions & 0 deletions network-service-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ else()
endif()
set(QT_NS 6)
set(DTK_NS Dtk6)

set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_PTHREADS_INIT 1)
set(CMAKE_PREFER_PTHREAD_FLAG ON)
Comment on lines +24 to +27
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Consider centralizing this logic and using modern CMake for threading.

This code is duplicated across four CMakeLists.txt files; consider moving it to a shared CMake file and including it where needed. Also, prefer find_package(Threads REQUIRED) and linking Threads::Threads for better portability and modern CMake practices.

Suggested implementation:

include(cmake/ThreadsConfig.cmake)

  1. Create a shared file at cmake/ThreadsConfig.cmake with the following content:
    find_package(Threads REQUIRED)
    
  2. In this CMakeLists.txt, ensure that your target (e.g., target_link_libraries(your_target PRIVATE Threads::Threads)) is linked to Threads::Threads.
  3. Repeat the include(cmake/ThreadsConfig.cmake) and target_link_libraries(... Threads::Threads) in the other three CMakeLists.txt files as needed.
  4. Adjust the path to ThreadsConfig.cmake if your project structure differs.


find_package(Qt${QT_NS} COMPONENTS Core Widgets DBus Network LinguistTools REQUIRED)
find_package(KF${QT_NS}NetworkManagerQt REQUIRED)
find_package(${DTK_NS} COMPONENTS Core REQUIRED)
Expand Down