From 7c5d404bb160482a852e2ba4cf1b7a9c60bdb0ee Mon Sep 17 00:00:00 2001 From: Ahmad Nawab Date: Wed, 4 Sep 2024 20:23:09 +0000 Subject: [PATCH] NVHPC BUG: workaround for nvhpc module import scoping bug --- src/ecwam/CMakeLists.txt | 5 +++++ src/programs/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ecwam/CMakeLists.txt b/src/ecwam/CMakeLists.txt index d03eed95..7d43f003 100644 --- a/src/ecwam/CMakeLists.txt +++ b/src/ecwam/CMakeLists.txt @@ -455,6 +455,11 @@ ecbuild_add_library( PUBLIC_DEFINITIONS ${ECWAM_DEFINITIONS} ) +# Workaround for import scoping bug in nvhpc +get_target_property(FIELD_API_INCLUDE_DIRS field_api_${prec} INTERFACE_INCLUDE_DIRECTORIES) +target_include_directories( ${ecwam} INTERFACE $ ) +target_include_directories( ${ecwam} INTERFACE $ ) + ecwam_target_fortran_module_directory( TARGET ${ecwam} MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/module/${ecwam} diff --git a/src/programs/CMakeLists.txt b/src/programs/CMakeLists.txt index 050fe57f..53757729 100644 --- a/src/programs/CMakeLists.txt +++ b/src/programs/CMakeLists.txt @@ -17,7 +17,7 @@ foreach( program ecbuild_add_executable( TARGET ${PROJECT_NAME}-${program} SOURCES ${program}.F90 - LIBS ${PROJECT_NAME} ${OpenMP_Fortran_LIBRARIES} $<${HAVE_ACC}:OpenACC::OpenACC_Fortran> field_api_${prec} + LIBS ${PROJECT_NAME} ${OpenMP_Fortran_LIBRARIES} $<${HAVE_ACC}:OpenACC::OpenACC_Fortran> LINKER_LANGUAGE Fortran ) ecwam_target_compile_definitions_FILENAME(${PROJECT_NAME}-${program})