diff --git a/src/horizontal/CMakeLists.txt b/src/horizontal/CMakeLists.txt index d2abe7de8470c35f06f52bc606addebda117c1dd..078a14df177906b11f6d3914ac815eb4b28ed162 100644 --- a/src/horizontal/CMakeLists.txt +++ b/src/horizontal/CMakeLists.txt @@ -39,7 +39,9 @@ if(IM_ENABLE_OPENACC) # If _OPENACC is defined, assume that the required compiler flags are already # provided, e.g. in CMAKE_Fortran_FLAGS: if(NOT HAS_OPENACC_MACRO) - target_compile_options(iconmath-horizontal PRIVATE ${OpenACC_Fortran_OPTIONS}) + target_compile_options(iconmath-horizontal + PRIVATE + $<$<COMPILE_LANGUAGE:Fortran>:${OpenACC_Fortran_OPTIONS}>) # This make sures that unit tests (FortUTF) compiles without the need of # passing OpenACC compile option. target_link_libraries(iconmath-horizontal PRIVATE OpenACC::OpenACC_Fortran) diff --git a/src/interpolation/CMakeLists.txt b/src/interpolation/CMakeLists.txt index 346aaaae748d8b887da284ad93e5e6eae621bf05..f982f3b8ceeb9ecb13ade2f5dc04e42b4f23f9fc 100644 --- a/src/interpolation/CMakeLists.txt +++ b/src/interpolation/CMakeLists.txt @@ -41,7 +41,8 @@ if(IM_ENABLE_OPENACC) # provided, e.g. in CMAKE_Fortran_FLAGS: if(NOT HAS_OPENACC_MACRO) target_compile_options(iconmath-interpolation - PRIVATE ${OpenACC_Fortran_OPTIONS}) + PRIVATE + $<$<COMPILE_LANGUAGE:Fortran>:${OpenACC_Fortran_OPTIONS}>) # This make sures that unit tests (FortUTF) compiles without the need of # passing OpenACC compile option. target_link_libraries(iconmath-interpolation PRIVATE OpenACC::OpenACC_Fortran) diff --git a/src/support/CMakeLists.txt b/src/support/CMakeLists.txt index ed6a4d333a206cb3436ab800e6cda24b7d68bd43..e78fc1642a7edc83201d189487d6a77c45ad3331 100644 --- a/src/support/CMakeLists.txt +++ b/src/support/CMakeLists.txt @@ -50,7 +50,9 @@ if(IM_ENABLE_OPENACC) # If _OPENACC is defined, assume that the required compiler flags are already # provided, e.g. in CMAKE_Fortran_FLAGS: if(NOT HAS_OPENACC_MACRO) - target_compile_options(iconmath-support PRIVATE ${OpenACC_Fortran_OPTIONS}) + target_compile_options(iconmath-support + PRIVATE + $<$<COMPILE_LANGUAGE:Fortran>:${OpenACC_Fortran_OPTIONS}>) # This make sures that unit tests (FortUTF) compiles without the need of # passing OpenACC compile option. target_link_libraries(iconmath-support PRIVATE OpenACC::OpenACC_Fortran)