From 3463e7d6036620ce1d0b66e61fbac837e3c08bd3 Mon Sep 17 00:00:00 2001 From: Jeff Curtis Date: Tue, 22 Oct 2024 20:24:45 -0500 Subject: [PATCH] less aggressive cmakelist --- CMakeLists.txt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac4f49545..7c7bc9cb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,15 +31,6 @@ include(FortranCInterface) # FortranCInterface_VERIFY(CXX) #endif() -if (ENABLE_TCHEM) - find_package(OpenMP REQUIRED) - 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 "${OpenMP_CXX_FLAGS}" CACHE STRING "" FORCE) - endif() -endif() - ###################################################################### # options @@ -263,12 +254,19 @@ target_link_libraries(partmclib ${NETCDF_LIBS} ${SUNDIALS_LIBS} ${KOKKOS_LIB} ${KOKKOSKERNEL_LIB} ${TINES_LIB} ${CPP_LIB} ${LAPACK_LIB}) if (ENABLE_TCHEM) + find_package(OpenMP REQUIRED) + if (ENABLE_TCHEM_GPU) + add_link_options(${OpenMP_CXX_FLAGS}) + else() + add_link_options(${OpenMP_Fortran_FLAGS}) + endif() 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) + add_link_options(${OpenMP_CXX_FLAGS}) set_target_properties(partmclib PROPERTIES LINKER_LANGUAGE CXX) endif()