diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 16e09af077..b2e7ecbd87 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -74,7 +74,7 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF) mark_as_advanced(ENABLE_COVERAGE) if(ENABLE_COVERAGE) - set (CMAK_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage") endif() endif() diff --git a/cmake/LAMMPSConfig.cmake.in b/cmake/LAMMPSConfig.cmake.in index da7ca59fb9..fac56efba2 100644 --- a/cmake/LAMMPSConfig.cmake.in +++ b/cmake/LAMMPSConfig.cmake.in @@ -2,20 +2,22 @@ include(CMakeFindDependencyMacro) if(@BUILD_MPI@) find_dependency(MPI REQUIRED CXX) endif() -if(@PKG_KSPACE@ AND @FFT@ STREQUAL "FFTW3") - if(@FFTW@ STREQUAL "FFTW3" AND NOT TARGET FFTW3::FFTW3) - add_library(FFTW3::FFTW3 UNKNOWN IMPORTED) - set_target_properties(FFTW3::FFTW3 PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "@FFTW3_LIBRARY@" - INTERFACE_INCLUDE_DIRECTORIES "@FFTW3_INCLUDE_DIRS@") - endif() - if(@FFTW@ STREQUAL "FFTW3F" AND NOT TARGET FFTW3F::FFTW3F) - add_library(FFTW3F::FFTW3F UNKNOWN IMPORTED) - set_target_properties(FFTW3F::FFTW3F PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "@FFTW3F_LIBRARY@" - INTERFACE_INCLUDE_DIRECTORIES "@FFTW3F_INCLUDE_DIRS@") +if(@PKG_KSPACE@) + if(@FFT@ STREQUAL "FFTW3") + if(@FFTW@ STREQUAL "FFTW3" AND NOT TARGET FFTW3::FFTW3) + add_library(FFTW3::FFTW3 UNKNOWN IMPORTED) + set_target_properties(FFTW3::FFTW3 PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "@FFTW3_LIBRARY@" + INTERFACE_INCLUDE_DIRECTORIES "@FFTW3_INCLUDE_DIRS@") + endif() + if(@FFTW@ STREQUAL "FFTW3F" AND NOT TARGET FFTW3F::FFTW3F) + add_library(FFTW3F::FFTW3F UNKNOWN IMPORTED) + set_target_properties(FFTW3F::FFTW3F PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "@FFTW3F_LIBRARY@" + INTERFACE_INCLUDE_DIRECTORIES "@FFTW3F_INCLUDE_DIRS@") + endif() endif() endif() if(NOT @BUILD_SHARED_LIBS@) @@ -36,20 +38,22 @@ if(NOT @BUILD_SHARED_LIBS@) if(@PKG_USER-SMD@ AND NOT @DOWNLOAD_EIGEN3@) find_dependency(Eigen3 NO_MODULE REQUIRED) endif() - if(@PKG_KSPACE@ AND @FFT@ STREQUAL "FFTW3" AND @FFT_FFTW_THREADS@) - if(@FFTW@ STREQUAL "FFTW3" AND NOT TARGET FFTW3::FFTW3_OMP) - add_library(FFTW3::FFTW3_OMP UNKNOWN IMPORTED) - set_target_properties(FFTW3::FFTW3_OMP PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "@FFTW3_OMP_LIBRARY@" - INTERFACE_INCLUDE_DIRECTORIES "@FFTW3_OMP_INCLUDE_DIRS@") - endif() - if(@FFTW@ STREQUAL "FFTW3F" AND NOT TARGET FFTW3F::FFTW3F_OMP) - add_library(FFTW3F::FFTW3F_OMP UNKNOWN IMPORTED) - set_target_properties(FFTW3F::FFTW3F_OMP PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "@FFTW3F_OMP_LIBRARY@" - INTERFACE_INCLUDE_DIRECTORIES "@FFTW3F_OMP_INCLUDE_DIRS@") + if(@PKG_KSPACE@) + if(@FFT@ STREQUAL "FFTW3" AND @FFT_FFTW_THREADS@) + if(@FFTW@ STREQUAL "FFTW3" AND NOT TARGET FFTW3::FFTW3_OMP) + add_library(FFTW3::FFTW3_OMP UNKNOWN IMPORTED) + set_target_properties(FFTW3::FFTW3_OMP PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "@FFTW3_OMP_LIBRARY@" + INTERFACE_INCLUDE_DIRECTORIES "@FFTW3_OMP_INCLUDE_DIRS@") + endif() + if(@FFTW@ STREQUAL "FFTW3F" AND NOT TARGET FFTW3F::FFTW3F_OMP) + add_library(FFTW3F::FFTW3F_OMP UNKNOWN IMPORTED) + set_target_properties(FFTW3F::FFTW3F_OMP PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "@FFTW3F_OMP_LIBRARY@" + INTERFACE_INCLUDE_DIRECTORIES "@FFTW3F_OMP_INCLUDE_DIRS@") + endif() endif() endif() if(@PKG_USER-SCAFACOS@ AND NOT @DOWNLOAD_SCAFACOS@) diff --git a/cmake/Modules/Packages/KIM.cmake b/cmake/Modules/Packages/KIM.cmake index d7fe19d551..3734e10982 100644 --- a/cmake/Modules/Packages/KIM.cmake +++ b/cmake/Modules/Packages/KIM.cmake @@ -51,6 +51,9 @@ if(DOWNLOAD_KIM) INTERFACE_INCLUDE_DIRECTORIES "${INSTALL_DIR}/include/kim-api") target_link_libraries(lammps PRIVATE LAMMPS::KIM) add_dependencies(LAMMPS::KIM kim_build) + if(BUILD_LIB AND NOT BUILD_SHARED_LIBS) + install(CODE "MESSAGE(FATAL_ERROR \"Installing liblammps with downloaded libraries is currently not supported.\")") + endif() else() find_package(PkgConfig REQUIRED) pkg_check_modules(KIM-API REQUIRED IMPORTED_TARGET libkim-api>=${KIM-API_MIN_VERSION}) diff --git a/cmake/Modules/Packages/KOKKOS.cmake b/cmake/Modules/Packages/KOKKOS.cmake index 6491b25975..1b7e8affc5 100644 --- a/cmake/Modules/Packages/KOKKOS.cmake +++ b/cmake/Modules/Packages/KOKKOS.cmake @@ -35,6 +35,9 @@ if(DOWNLOAD_KOKKOS) INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) target_link_libraries(lammps PRIVATE LAMMPS::KOKKOS) add_dependencies(LAMMPS::KOKKOS kokkos_build) + if(BUILD_LIB AND NOT BUILD_SHARED_LIBS) + install(CODE "MESSAGE(FATAL_ERROR \"Installing liblammps with downloaded libraries is currently not supported.\")") + endif() elseif(EXTERNAL_KOKKOS) find_package(Kokkos 3) if(NOT Kokkos_FOUND) diff --git a/cmake/Modules/Packages/LATTE.cmake b/cmake/Modules/Packages/LATTE.cmake index 7b8025bf50..4279b5597f 100644 --- a/cmake/Modules/Packages/LATTE.cmake +++ b/cmake/Modules/Packages/LATTE.cmake @@ -27,6 +27,9 @@ if(DOWNLOAD_LATTE) INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}") target_link_libraries(lammps PRIVATE LAMMPS::LATTE) add_dependencies(LAMMPS::LATTE latte_build) + if(BUILD_LIB AND NOT BUILD_SHARED_LIBS) + install(CODE "MESSAGE(FATAL_ERROR \"Installing liblammps with downloaded libraries is currently not supported.\")") + endif() else() find_package(LATTE) if(NOT LATTE_FOUND) diff --git a/cmake/Modules/Packages/MSCG.cmake b/cmake/Modules/Packages/MSCG.cmake index 55f71588fe..9254935c20 100644 --- a/cmake/Modules/Packages/MSCG.cmake +++ b/cmake/Modules/Packages/MSCG.cmake @@ -35,6 +35,9 @@ if(DOWNLOAD_MSCG) INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}") target_link_libraries(lammps PRIVATE LAMMPS::MSCG) add_dependencies(LAMMPS::MSCG mscg_build) + if(BUILD_LIB AND NOT BUILD_SHARED_LIBS) + install(CODE "MESSAGE(FATAL_ERROR \"Installing liblammps with downloaded libraries is currently not supported.\")") + endif() else() find_package(MSCG) if(NOT MSCG_FOUND) diff --git a/cmake/Modules/Packages/USER-PLUMED.cmake b/cmake/Modules/Packages/USER-PLUMED.cmake index d47c365637..53e424224d 100644 --- a/cmake/Modules/Packages/USER-PLUMED.cmake +++ b/cmake/Modules/Packages/USER-PLUMED.cmake @@ -70,6 +70,9 @@ if(DOWNLOAD_PLUMED) ExternalProject_get_property(plumed_build INSTALL_DIR) add_library(LAMMPS::PLUMED UNKNOWN IMPORTED) add_dependencies(LAMMPS::PLUMED plumed_build) + if(BUILD_LIB AND NOT BUILD_SHARED_LIBS) + install(CODE "MESSAGE(FATAL_ERROR \"Installing liblammps with downloaded libraries is currently not supported.\")") + endif() if(PLUMED_MODE STREQUAL "STATIC") set_target_properties(LAMMPS::PLUMED PROPERTIES INTERFACE_COMPILE_DEFINITIONS "__PLUMED_WRAPPER_CXX=1") set_target_properties(LAMMPS::PLUMED PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/lib/libplumed.a INTERFACE_LINK_LIBRARIES "${PLUMED_LINK_LIBS};${CMAKE_DL_LIBS}") diff --git a/cmake/Modules/Packages/USER-SCAFACOS.cmake b/cmake/Modules/Packages/USER-SCAFACOS.cmake index d92a83f7c1..d51504bcc8 100644 --- a/cmake/Modules/Packages/USER-SCAFACOS.cmake +++ b/cmake/Modules/Packages/USER-SCAFACOS.cmake @@ -52,6 +52,9 @@ if(DOWNLOAD_SCAFACOS) INTERFACE_LINK_LIBRARIES "${INSTALL_DIR}/lib/libfcs.a;${INSTALL_DIR}/lib/libfcs_direct.a;${INSTALL_DIR}/lib/libfcs_ewald.a;${INSTALL_DIR}/lib/libfcs_fmm.a;${INSTALL_DIR}/lib/libfcs_p2nfft.a;${INSTALL_DIR}/lib/libfcs_p3m.a;GSL::gsl;${INSTALL_DIR}/lib/libfcs_near.a;${INSTALL_DIR}/lib/libfcs_gridsort.a;${INSTALL_DIR}/lib/libfcs_resort.a;${INSTALL_DIR}/lib/libfcs_redist.a;${INSTALL_DIR}/lib/libfcs_common.a;${INSTALL_DIR}/lib/libfcs_pnfft.a;${INSTALL_DIR}/lib/libfcs_pfft.a;${INSTALL_DIR}/lib/libfcs_fftw3_mpi.a;${INSTALL_DIR}/lib/libfcs_fftw3.a;MPI::MPI_Fortran;MPI::MPI_C") target_link_libraries(lammps PRIVATE LAMMPS::SCAFACOS) add_dependencies(LAMMPS::SCAFACOS scafacos_build) + if(BUILD_LIB AND NOT BUILD_SHARED_LIBS) + install(CODE "MESSAGE(FATAL_ERROR \"Installing liblammps with downloaded libraries is currently not supported.\")") + endif() else() find_package(PkgConfig REQUIRED) pkg_check_modules(SCAFACOS REQUIRED IMPORTED_TARGET scafacos) diff --git a/cmake/Modules/Packages/USER-SMD.cmake b/cmake/Modules/Packages/USER-SMD.cmake index 6984b24d52..c2775c5a8e 100644 --- a/cmake/Modules/Packages/USER-SMD.cmake +++ b/cmake/Modules/Packages/USER-SMD.cmake @@ -18,6 +18,9 @@ if(DOWNLOAD_EIGEN3) set_target_properties(LAMMPS::EIGEN3 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}") target_link_libraries(lammps PRIVATE LAMMPS::EIGEN3) add_dependencies(LAMMPS::EIGEN3 Eigen3_build) + if(BUILD_LIB AND NOT BUILD_SHARED_LIBS) + install(CODE "MESSAGE(FATAL_ERROR \"Installing liblammps with downloaded libraries is currently not supported.\")") + endif() else() find_package(Eigen3 NO_MODULE) mark_as_advanced(Eigen3_DIR) diff --git a/cmake/Modules/Packages/VORONOI.cmake b/cmake/Modules/Packages/VORONOI.cmake index 39d494928b..69c2ab3301 100644 --- a/cmake/Modules/Packages/VORONOI.cmake +++ b/cmake/Modules/Packages/VORONOI.cmake @@ -35,6 +35,9 @@ if(DOWNLOAD_VORO) INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/src") target_link_libraries(lammps PRIVATE LAMMPS::VORO) add_dependencies(LAMMPS::VORO voro_build) + if(BUILD_LIB AND NOT BUILD_SHARED_LIBS) + install(CODE "MESSAGE(FATAL_ERROR \"Installing liblammps with downloaded libraries is currently not supported.\")") + endif() else() find_package(VORO) if(NOT VORO_FOUND) diff --git a/cmake/Modules/Testing.cmake b/cmake/Modules/Testing.cmake index 0eeef00fe9..dee47b9040 100644 --- a/cmake/Modules/Testing.cmake +++ b/cmake/Modules/Testing.cmake @@ -28,7 +28,7 @@ if(ENABLE_TESTING AND BUILD_EXE) "https://github.com/lammps/lammps-testing in LAMMPS_TESTING_SOURCE_DIR") endif() - add_test(ShowHelp ${CMAKE_BINARY_DIR}/${LAMMPS_BINARY} -help) + add_test(NAME ShowHelp COMMAND $ -help) if(EXISTS ${LAMMPS_TESTING_SOURCE_DIR}) message(STATUS "Running test discovery...") @@ -42,8 +42,7 @@ if(ENABLE_TESTING AND BUILD_EXE) string(REPLACE "-" "_" TEST_NAME ${TEST_NAME}) string(REPLACE "+" "_" TEST_NAME ${TEST_NAME}) set(TEST_NAME "test_core_${TEST_NAME}_serial") - add_test(${TEST_NAME} ${CMAKE_BINARY_DIR}/${LAMMPS_BINARY} -in ${SCRIPT_NAME}) - set_tests_properties(${TEST_NAME} PROPERTIES WORKING_DIRECTORY ${PARENT_DIR}) + add_test(NAME ${TEST_NAME} COMMAND $ -in ${SCRIPT_NAME} WORKING_DIRECTORY ${PARENT_DIR}) endforeach() list(LENGTH TEST_SCRIPTS NUM_TESTS)