From d0fa7a99e5111ccf072e6ffbff149db72d2ba06d Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Mon, 4 Dec 2023 11:41:19 -0800 Subject: [PATCH] Remove PUBLIC from target_link_libraries with OpenMP::OpenMP_CXX 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) ``` --- pybind_interface/cuda/CMakeLists.txt | 2 +- pybind_interface/custatevec/CMakeLists.txt | 2 +- pybind_interface/decide/CMakeLists.txt | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pybind_interface/cuda/CMakeLists.txt b/pybind_interface/cuda/CMakeLists.txt index 89df1948..e5644d4e 100644 --- a/pybind_interface/cuda/CMakeLists.txt +++ b/pybind_interface/cuda/CMakeLists.txt @@ -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) diff --git a/pybind_interface/custatevec/CMakeLists.txt b/pybind_interface/custatevec/CMakeLists.txt index 77fe6631..8c1d3871 100644 --- a/pybind_interface/custatevec/CMakeLists.txt +++ b/pybind_interface/custatevec/CMakeLists.txt @@ -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) diff --git a/pybind_interface/decide/CMakeLists.txt b/pybind_interface/decide/CMakeLists.txt index 15d51707..6b36282c 100644 --- a/pybind_interface/decide/CMakeLists.txt +++ b/pybind_interface/decide/CMakeLists.txt @@ -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) @@ -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)