From bcd50646b4f66f055adfcee459ba5c4e6723c21f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 5 May 2020 10:23:04 -0400 Subject: [PATCH] don't enable fortran if the generator does not support it. --- cmake/CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0ee0ef3772..ac28e58f3e 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -553,11 +553,15 @@ if(BUILD_TOOLS) install(TARGETS binary2txt DESTINATION ${CMAKE_INSTALL_BINDIR}) include(CheckGeneratorSupport) - enable_language(Fortran) - if(CMAKE_GENERATOR_SUPPORT_FORTRAN AND CMAKE_Fortran_COMPILER) - add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f) - target_link_libraries(chain.x PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) - install(TARGETS chain.x DESTINATION ${CMAKE_INSTALL_BINDIR}) + if(CMAKE_GENERATOR_SUPPORT_FORTRAN) + enable_language(Fortran) + if(CMAKE_Fortran_COMPILER) + add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f) + target_link_libraries(chain.x PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) + install(TARGETS chain.x DESTINATION ${CMAKE_INSTALL_BINDIR}) + else() + message(WARNING "No suitable Fortran compiler found, skipping building 'chain.x'") + endif() else() message(WARNING "CMake build doesn't support fortran, skipping building 'chain.x'") endif()