diff --git a/test_downstream/.gitignore b/test_downstream/.gitignore new file mode 100644 index 000000000..378eac25d --- /dev/null +++ b/test_downstream/.gitignore @@ -0,0 +1 @@ +build diff --git a/test_downstream/CMakeLists.txt b/test_downstream/CMakeLists.txt new file mode 100644 index 000000000..390aea563 --- /dev/null +++ b/test_downstream/CMakeLists.txt @@ -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 ) + diff --git a/test_downstream/README b/test_downstream/README new file mode 100644 index 000000000..e46358cd9 --- /dev/null +++ b/test_downstream/README @@ -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= # can be install or build dir!!! + cmake -S . -B build + cmake --build build + build/main + diff --git a/test_downstream/main.F90 b/test_downstream/main.F90 new file mode 100644 index 000000000..3fe20d678 --- /dev/null +++ b/test_downstream/main.F90 @@ -0,0 +1,5 @@ +program main +use mod_mesh + + +end program