Skip to content

Commit

Permalink
Add test_downstream
Browse files Browse the repository at this point in the history
  • Loading branch information
wdeconinck committed Nov 2, 2023
1 parent 148c5d2 commit b3563ae
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions test_downstream/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
37 changes: 37 additions & 0 deletions test_downstream/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)

project(test_downstream LANGUAGES Fortran)

find_package(fesom REQUIRED)

message("fesom found: ${fesom_DIR}")
message("fesom_VERSION: ${fesom_VERSION}")
message("fesom_HAVE_OPENMP: ${fesom_HAVE_OPENMP}")
message("fesom_HAVE_IFS_INTERFACE: ${fesom_HAVE_IFS_INTERFACE}")

if(NOT TARGET fesom)
message(FATAL_ERROR "fesom was installed wrongly: fesom target not found")
endif()

if (ASSERT_FESOM_DIR)
if (NOT fesom_DIR MATCHES "${ASSERT_FESOM_DIR}")
message(FATAL_ERROR "fesom was not found in expected location ${ASSERT_FESOM_DIR}")
endif()
endif()

if (DEFINED ASSERT_HAVE_IFS_INTERFACE)
if (ASSERT_HAVE_IFS_INTERFACE AND NOT fesom_HAVE_IFS_INTERFACE)
message(FATAL_ERROR "fesom was installed wrongly: fesom_HAVE_IFS_INTERFACE=${fesom_HAVE_IFS_INTERFACE}")
elseif (NOT ASSERT_HAVE_IFS_INTERFACE AND fesom_HAVE_IFS_INTERFACE)
message(FATAL_ERROR "fesom was installed wrongly: fesom_HAVE_IFS_INTERFACE=${fesom_HAVE_IFS_INTERFACE}")
endif()
endif()

get_target_property(target_type fesom TYPE)
if( NOT target_type MATCHES "STATIC_LIBRARY|SHARED_LIBRARY")
message(FATAL_ERROR "fesom target's TYPE is expected to be STATIC_LIBRARY or SHARED_LIBRARY. Actual TYPE: ${target_type}")
endif ()

add_executable( main main.F90 )
target_link_libraries( main fesom )

9 changes: 9 additions & 0 deletions test_downstream/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This dummy project can be used to test if fesom was installed and can be found correctly in downstream CMake projects

Example use:

export fesom_ROOT=<path-to-fesom-prefix> # can be install or build dir!!!
cmake -S . -B build
cmake --build build
build/main

5 changes: 5 additions & 0 deletions test_downstream/main.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
program main
use mod_mesh


end program

0 comments on commit b3563ae

Please sign in to comment.