File: CMakeLists.txt

package info (click to toggle)
lammps 20220106.git7586adbb6a%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 348,064 kB
  • sloc: cpp: 831,421; python: 24,896; xml: 14,949; f90: 10,845; ansic: 7,967; sh: 4,226; perl: 4,064; fortran: 2,424; makefile: 1,501; objc: 238; lisp: 163; csh: 16; awk: 14; tcl: 6
file content (36 lines) | stat: -rw-r--r-- 1,378 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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(NOT CMAKE_Fortran_COMPILER_ID)
  message(STATUS "Skipping Tests for the LAMMPS Fortran Module: cannot identify Fortran compiler")
  return()
endif()

if(CMAKE_Fortran_COMPILER)
  enable_language(C)
  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(test_fortran_create wrap_create.cpp test_fortran_create.f90)
  target_link_libraries(test_fortran_create PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTest GTest::GTestMain)
  add_test(FortranOpen test_fortran_create)

  add_executable(test_fortran_commands wrap_commands.cpp test_fortran_commands.f90)
  target_link_libraries(test_fortran_commands PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTest GTest::GTestMain)
  add_test(FortranCommands test_fortran_commands)
else()
  message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no Fortran compiler")
endif()