Skip to content

Commit

Permalink
Remove PUBLIC from target_link_libraries with OpenMP::OpenMP_CXX
Browse files Browse the repository at this point in the history
Otherwise this could lead to the following problem when building with CUDA:
```
  CMake Error at pybind_interface/cuda/CMakeLists.txt:30 (target_link_libraries):
    The plain signature for target_link_libraries has already been used with
    the target "qsim_cuda".  All uses of target_link_libraries with a target
    must be either all-keyword or all-plain.

    The uses of the plain signature are here:

     * /usr/share/cmake-3.16/Modules/FindCUDA.cmake:1836 (target_link_libraries)
```
  • Loading branch information
basnijholt committed Dec 4, 2023
1 parent 1f37b8b commit d0fa7a9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pybind_interface/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ set_target_properties(qsim_cuda PROPERTIES
)
set_source_files_properties(pybind_main_cuda.cpp PROPERTIES LANGUAGE CUDA)

target_link_libraries(qsim_cuda PUBLIC OpenMP::OpenMP_CXX)
target_link_libraries(qsim_cuda OpenMP::OpenMP_CXX)
2 changes: 1 addition & 1 deletion pybind_interface/custatevec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ set_target_properties(qsim_custatevec PROPERTIES
)
set_source_files_properties(pybind_main_custatevec.cpp PROPERTIES LANGUAGE CUDA)

target_link_libraries(qsim_custatevec PUBLIC OpenMP::OpenMP_CXX)
target_link_libraries(qsim_custatevec OpenMP::OpenMP_CXX)
4 changes: 3 additions & 1 deletion pybind_interface/decide/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if(has_nvcc)
SUFFIX "${PYTHON_MODULE_EXTENSION}"
)
set_source_files_properties(decide.cpp PROPERTIES LANGUAGE CUDA)
target_link_libraries(qsim_decide OpenMP::OpenMP_CXX)
elseif(has_hipcc)
list(APPEND CMAKE_MODULE_PATH "/opt/rocm/lib/cmake/hip")
find_package(HIP REQUIRED)
Expand All @@ -41,8 +42,9 @@ elseif(has_hipcc)
PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}"
)
target_link_libraries(qsim_decide PUBLIC OpenMP::OpenMP_CXX)
else()
pybind11_add_module(qsim_decide decide.cpp)
target_link_libraries(qsim_decide PUBLIC OpenMP::OpenMP_CXX)
endif()

target_link_libraries(qsim_decide PUBLIC OpenMP::OpenMP_CXX)

0 comments on commit d0fa7a9

Please sign in to comment.