Skip to content

CMake: use target dependencies for OpenMP #1594

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

Open
KrisThielemans opened this issue May 9, 2025 · 0 comments
Open

CMake: use target dependencies for OpenMP #1594

KrisThielemans opened this issue May 9, 2025 · 0 comments
Assignees

Comments

@KrisThielemans
Copy link
Collaborator

We currently still have

STIR/src/CMakeLists.txt

Lines 137 to 147 in 4e57186

find_package(OpenMP REQUIRED)
add_definitions(${OpenMP_CXX_FLAGS})
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# work around https://gitlab.kitware.com/cmake/cmake/-/issues/26037
set (OpenMP_EXE_LINKER_FLAGS OpenMP::OpenMP_CXX -latomic)
message(STATUS "OpenMP Linker flags for Clang: ${OpenMP_EXE_LINKER_FLAGS}")
else()
set (OpenMP_EXE_LINKER_FLAGS OpenMP::OpenMP_CXX)
endif()
endif()
which is largely historical. OpenMP_CXX_FLAGS doesn't seem to be used anywhere and We shouldn't need the OpenMP_EXE_LINKER_FLAGS should really be renamed to OpenMP_target_link_libraries or so, as it's only used for target_link_libraries, e.g.
if (STIR_OPENMP)
target_link_libraries(buildblock PUBLIC ${OpenMP_EXE_LINKER_FLAGS})
endif()

if (STIR_OPENMP)
target_link_libraries(recon_buildblock PUBLIC ${OpenMP_EXE_LINKER_FLAGS})
endif()

and in the SWIG CMakeLists.txt.

I think we need the variable to work-around the atomic problem,

See also #1494

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant