summaryrefslogtreecommitdiffstats
path: root/Tests/FindOpenACC/FortranTest
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2019-07-30 15:01:57 (GMT)
committerBrad King <brad.king@kitware.com>2019-08-19 19:20:38 (GMT)
commitf4fc0667ae406c8f6b4c3e22a73ae4a7a075404b (patch)
treeaf34a92c3d13d3230f208b9f6f76513052e2d0b0 /Tests/FindOpenACC/FortranTest
parent9460501ad7353e6eecdf42d56568c1f909f64e27 (diff)
downloadCMake-f4fc0667ae406c8f6b4c3e22a73ae4a7a075404b.zip
CMake-f4fc0667ae406c8f6b4c3e22a73ae4a7a075404b.tar.gz
CMake-f4fc0667ae406c8f6b4c3e22a73ae4a7a075404b.tar.bz2
FindOpenACC: Provide import targets and OpenACC_<lang>_OPTIONS variable
Previously the FindOpenACC module had issues where the contents of OpenACC_<lang>_FLAGS could not be used with target_compile_options when it contained multiple compiler flags.
Diffstat (limited to 'Tests/FindOpenACC/FortranTest')
-rw-r--r--Tests/FindOpenACC/FortranTest/CMakeLists.txt11
-rw-r--r--Tests/FindOpenACC/FortranTest/main.f909
2 files changed, 20 insertions, 0 deletions
diff --git a/Tests/FindOpenACC/FortranTest/CMakeLists.txt b/Tests/FindOpenACC/FortranTest/CMakeLists.txt
new file mode 100644
index 0000000..12e3503
--- /dev/null
+++ b/Tests/FindOpenACC/FortranTest/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 3.14)
+project(VerifyFindOpenAcc Fortran)
+
+find_package(OpenACC REQUIRED)
+
+add_executable(UsesOpenACC main.f90)
+target_link_libraries(UsesOpenACC PRIVATE OpenACC::OpenACC_Fortran)
+
+add_executable(UsesOpenACCVars main.f90)
+target_link_options(UsesOpenACCVars PRIVATE ${OpenACC_Fortran_OPTIONS})
+target_compile_options(UsesOpenACCVars PRIVATE ${OpenACC_Fortran_OPTIONS})
diff --git a/Tests/FindOpenACC/FortranTest/main.f90 b/Tests/FindOpenACC/FortranTest/main.f90
new file mode 100644
index 0000000..2ff1ba0
--- /dev/null
+++ b/Tests/FindOpenACC/FortranTest/main.f90
@@ -0,0 +1,9 @@
+program t
+integer(4) a(10000)
+a = [ (1+i,i=1,10000) ]
+!$acc kernels
+do i = 1, 10000
+ if (a(i)/3000*3000.eq.a(i)) print *," located ",i,a(i),i.gt.5000,a(i)/5.0
+end do
+!$acc end kernels
+end