31 lines
1.1 KiB
CMake
31 lines
1.1 KiB
CMake
include(CheckGeneratorSupport)
|
|
if(NOT CMAKE_GENERATOR_SUPPORT_FORTRAN)
|
|
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no Fortran support in build tool")
|
|
return()
|
|
endif()
|
|
|
|
include(CheckLanguage)
|
|
check_language(Fortran)
|
|
if(CMAKE_Fortran_COMPILER)
|
|
enable_language(Fortran)
|
|
get_filename_component(LAMMPS_FORTRAN_MODULE ${LAMMPS_SOURCE_DIR}/../fortran/lammps.f90 ABSOLUTE)
|
|
if(BUILD_MPI)
|
|
find_package(MPI REQUIRED)
|
|
else()
|
|
add_library(fmpi_stubs STATIC mpi_stubs.f90)
|
|
add_library(MPI::MPI_Fortran ALIAS fmpi_stubs)
|
|
endif()
|
|
|
|
add_library(flammps STATIC ${LAMMPS_FORTRAN_MODULE})
|
|
|
|
add_executable(fortran-create wrap-create.cpp fortran-create.f90)
|
|
target_link_libraries(fortran-create PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTest GTest::GTestMain)
|
|
add_test(FortranOpen fortran-create)
|
|
|
|
add_executable(fortran-commands wrap-commands.cpp fortran-commands.f90)
|
|
target_link_libraries(fortran-commands PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTest GTest::GTestMain)
|
|
add_test(FortranCommands fortran-commands)
|
|
else()
|
|
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no Fortran compiler")
|
|
endif()
|