simplify based on suggestions from @junghans

This commit is contained in:
Axel Kohlmeyer
2020-10-05 11:44:19 -04:00
parent b6d333535c
commit bd206dca10

View File

@ -644,19 +644,15 @@ if(BUILD_TOOLS)
endif()
if(BUILD_LAMMPS_SHELL)
include(FindPkgConfig)
pkg_check_modules(READLINE IMPORTED_TARGET readline)
if(PKG_CONFIG_FOUND AND READLINE_FOUND)
if(NOT LAMMPS_EXCEPTIONS)
message(WARNING "The LAMMPS shell needs LAMMPS_EXCEPTIONS enabled for full functionality")
endif()
add_executable(lammps-shell ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.cpp)
target_compile_definitions(lammps-shell PRIVATE -DLAMMPS_LIB_NO_MPI)
target_link_libraries(lammps-shell PRIVATE lammps;PkgConfig::READLINE)
install(TARGETS lammps-shell DESTINATION ${CMAKE_INSTALL_BINDIR})
else()
message(FATAL_ERROR "pkg-config and readline library not found. Cannot build LAMMPS shell")
find_package(PkgConfig REQUIRED)
pkg_check_modules(READLINE IMPORTED_TARGET REQUIRED readline)
if(NOT LAMMPS_EXCEPTIONS)
message(WARNING "The LAMMPS shell needs LAMMPS_EXCEPTIONS enabled for full functionality")
endif()
add_executable(lammps-shell ${LAMMPS_TOOLS_DIR}/lammps-shell/lammps-shell.cpp)
target_compile_definitions(lammps-shell PRIVATE -DLAMMPS_LIB_NO_MPI)
target_link_libraries(lammps-shell PRIVATE lammps PkgConfig::READLINE)
install(TARGETS lammps-shell EXPORT LAMMPS_Targets DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
include(Documentation)