From 986c8a2a606cee5f9927d30226f498f78e6a1edc Mon Sep 17 00:00:00 2001 From: Jeff Curtis Date: Sun, 20 Oct 2024 20:29:05 -0500 Subject: [PATCH] move tchem needed libraries out of compiler flags --- CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b54a56ff8..ac4f49545 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,10 +33,10 @@ include(FortranCInterface) if (ENABLE_TCHEM) find_package(OpenMP REQUIRED) - set(CMAKE_C_FLAGS "-lpthread -ldl ${OpenMP_C_FLAGS}" CACHE STRING "" FORCE) - set(CMAKE_Fortran_FLAGS "-lpthread -ldl ${OpenMP_Fortran_FLAGS}" CACHE STRING "" FORCE) + set(CMAKE_C_FLAGS "${OpenMP_C_FLAGS}" CACHE STRING "" FORCE) + set(CMAKE_Fortran_FLAGS "${OpenMP_Fortran_FLAGS}" CACHE STRING "" FORCE) if (ENABLE_TCHEM_GPU) - set(CMAKE_CXX_FLAGS "-lpthread -ldl ${OpenMP_CXX_FLAGS}" CACHE STRING "" FORCE) + set(CMAKE_CXX_FLAGS "${OpenMP_CXX_FLAGS}" CACHE STRING "" FORCE) endif() endif() @@ -262,6 +262,11 @@ target_link_libraries(partmclib ${NETCDF_LIBS} ${SUNDIALS_LIBS} ${MOSAIC_LIB} ${GSL_LIBS} ${CAMP_LIB} ${TCHEM_LIB} ${YAML_LIB} ${KOKKOS_LIB} ${KOKKOSKERNEL_LIB} ${TINES_LIB} ${CPP_LIB} ${LAPACK_LIB}) +if (ENABLE_TCHEM) + include(FindThreads) + target_link_libraries(partmclib ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) +endif() + set_target_properties(partmclib PROPERTIES OUTPUT_NAME partmc) if (ENABLE_TCHEM_GPU) set_target_properties(partmclib PROPERTIES LINKER_LANGUAGE CXX)