mirror of https://github.com/lammps/lammps.git
recover original new style library target names through ALIAS library definitions
This commit is contained in:
parent
b57c8bda51
commit
ad81dd3960
|
@ -13,6 +13,10 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
|||
|
||||
include(ExternalCMakeProject)
|
||||
ExternalCMakeProject(googletest ${GTEST_URL} ${GTEST_MD5} googletest .)
|
||||
add_library(GTest::GTest ALIAS gtest)
|
||||
add_library(GTest::GMock ALIAS gmock)
|
||||
add_library(GTest::GTestMain ALIAS gtest_main)
|
||||
add_library(GTest::GMockMain ALIAS gmock_main)
|
||||
|
||||
########################################
|
||||
# General tests using the LAMMPS executable itself
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
|
||||
add_executable(test_library_open test_library_open.cpp test_main.cpp)
|
||||
target_link_libraries(test_library_open PRIVATE lammps gmock)
|
||||
target_link_libraries(test_library_open PRIVATE lammps GTest::GMock)
|
||||
add_test(LibraryOpen test_library_open)
|
||||
|
||||
add_executable(test_library_commands test_library_commands.cpp test_main.cpp)
|
||||
target_link_libraries(test_library_commands PRIVATE lammps gmock)
|
||||
target_link_libraries(test_library_commands PRIVATE lammps GTest::GMock)
|
||||
add_test(LibraryCommands test_library_commands)
|
||||
|
||||
add_executable(test_library_external test_library_external.cpp test_main.cpp)
|
||||
target_link_libraries(test_library_external PRIVATE lammps gmock)
|
||||
target_link_libraries(test_library_external PRIVATE lammps GTest::GMock)
|
||||
add_test(LibraryExternal test_library_external)
|
||||
|
||||
add_executable(test_library_properties test_library_properties.cpp test_main.cpp)
|
||||
target_link_libraries(test_library_properties PRIVATE lammps gmock)
|
||||
target_link_libraries(test_library_properties PRIVATE lammps GTest::GMock)
|
||||
target_compile_definitions(test_library_properties PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_test(LibraryProperties test_library_properties)
|
||||
set_tests_properties(LibraryProperties PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
||||
|
||||
add_executable(test_library_scatter_gather test_library_scatter_gather.cpp test_main.cpp)
|
||||
target_link_libraries(test_library_scatter_gather PRIVATE lammps gmock)
|
||||
target_link_libraries(test_library_scatter_gather PRIVATE lammps GTest::GMock)
|
||||
target_compile_definitions(test_library_scatter_gather PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_test(LibraryScatterGather test_library_scatter_gather)
|
||||
set_tests_properties(LibraryScatterGather PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
||||
|
@ -63,11 +63,11 @@ foreach(WITH "JPEG" "PNG" "GZIP" "FFMPEG")
|
|||
endforeach()
|
||||
|
||||
add_executable(test_library_config test_library_config.cpp test_main.cpp)
|
||||
target_link_libraries(test_library_config PRIVATE lammps gmock)
|
||||
target_link_libraries(test_library_config PRIVATE lammps GTest::GMock)
|
||||
target_compile_definitions(test_library_config PRIVATE ${TEST_CONFIG_DEFS})
|
||||
add_test(LibraryConfig test_library_config)
|
||||
|
||||
add_executable(test_library_mpi test_library_mpi.cpp)
|
||||
target_link_libraries(test_library_mpi PRIVATE lammps gmock)
|
||||
target_link_libraries(test_library_mpi PRIVATE lammps GTest::GMock)
|
||||
target_compile_definitions(test_library_mpi PRIVATE ${TEST_CONFIG_DEFS})
|
||||
add_mpi_test(NAME LibraryMPI NUM_PROCS 4 COMMAND $<TARGET_FILE:test_library_mpi>)
|
||||
|
|
|
@ -8,21 +8,21 @@ if((NOT (CMAKE_SYSTEM_NAME STREQUAL "Windows")) AND PKG_PLUGIN)
|
|||
target_compile_definitions(test_simple_commands PRIVATE -DLMP_PLUGIN)
|
||||
endif()
|
||||
|
||||
target_link_libraries(test_simple_commands PRIVATE lammps gmock)
|
||||
target_link_libraries(test_simple_commands PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME SimpleCommands COMMAND test_simple_commands WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_tests_properties(SimpleCommands PROPERTIES
|
||||
ENVIRONMENT "LAMMPS_PLUGIN_BIN_DIR=${CMAKE_BINARY_DIR}/build-plugins")
|
||||
|
||||
add_executable(test_lattice_region test_lattice_region.cpp)
|
||||
target_link_libraries(test_lattice_region PRIVATE lammps gmock)
|
||||
target_link_libraries(test_lattice_region PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME LatticeRegion COMMAND test_lattice_region WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(test_groups test_groups.cpp)
|
||||
target_link_libraries(test_groups PRIVATE lammps gmock)
|
||||
target_link_libraries(test_groups PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME Groups COMMAND test_groups WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(test_variables test_variables.cpp)
|
||||
target_link_libraries(test_variables PRIVATE lammps gmock)
|
||||
target_link_libraries(test_variables PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME Variables COMMAND test_variables WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(test_kim_commands test_kim_commands.cpp)
|
||||
|
@ -33,15 +33,15 @@ if(KIM_EXTRA_UNITTESTS)
|
|||
message(FATAL_ERROR "CURL not found. Enabling KIM extra unit tests requires to have libcurl installed.")
|
||||
endif()
|
||||
endif()
|
||||
target_link_libraries(test_kim_commands PRIVATE lammps gmock)
|
||||
target_link_libraries(test_kim_commands PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME KimCommands COMMAND test_kim_commands WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(test_reset_ids test_reset_ids.cpp)
|
||||
target_compile_definitions(test_reset_ids PRIVATE -DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(test_reset_ids PRIVATE lammps gmock)
|
||||
target_link_libraries(test_reset_ids PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME ResetIDs COMMAND test_reset_ids WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(test_mpi_load_balancing test_mpi_load_balancing.cpp)
|
||||
target_link_libraries(test_mpi_load_balancing PRIVATE lammps gmock)
|
||||
target_link_libraries(test_mpi_load_balancing PRIVATE lammps GTest::GMock)
|
||||
target_compile_definitions(test_mpi_load_balancing PRIVATE ${TEST_CONFIG_DEFS})
|
||||
add_mpi_test(NAME MPILoadBalancing NUM_PROCS 4 COMMAND $<TARGET_FILE:test_mpi_load_balancing>)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
|
||||
add_executable(test_lammps_class test_lammps_class.cpp)
|
||||
target_link_libraries(test_lammps_class PRIVATE lammps gmock_main)
|
||||
target_link_libraries(test_lammps_class PRIVATE lammps GTest::GMockMain)
|
||||
add_test(LammpsClass test_lammps_class)
|
||||
set_tests_properties(LammpsClass PROPERTIES ENVIRONMENT "OMP_NUM_THREADS=1")
|
||||
|
||||
add_executable(test_input_class test_input_class.cpp)
|
||||
target_link_libraries(test_input_class PRIVATE lammps gtest_main)
|
||||
target_link_libraries(test_input_class PRIVATE lammps GTest::GTestMain)
|
||||
add_test(InputClass test_input_class)
|
||||
|
||||
add_executable(test_error_class test_error_class.cpp)
|
||||
target_link_libraries(test_error_class PRIVATE lammps gmock)
|
||||
target_link_libraries(test_error_class PRIVATE lammps GTest::GMock)
|
||||
add_test(ErrorClass test_error_class)
|
||||
|
|
|
@ -1,48 +1,48 @@
|
|||
|
||||
add_executable(test_atom_styles test_atom_styles.cpp)
|
||||
target_link_libraries(test_atom_styles PRIVATE lammps gmock)
|
||||
target_link_libraries(test_atom_styles PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME AtomStyles COMMAND test_atom_styles WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(test_image_flags test_image_flags.cpp)
|
||||
target_link_libraries(test_image_flags PRIVATE lammps gmock)
|
||||
target_link_libraries(test_image_flags PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME ImageFlags COMMAND test_image_flags WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(test_input_convert test_input_convert.cpp)
|
||||
target_link_libraries(test_input_convert PRIVATE lammps gmock_main)
|
||||
target_link_libraries(test_input_convert PRIVATE lammps GTest::GMockMain)
|
||||
add_test(NAME InputConvert COMMAND test_input_convert WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(test_molecule_file test_molecule_file.cpp)
|
||||
target_link_libraries(test_molecule_file PRIVATE lammps gmock)
|
||||
target_link_libraries(test_molecule_file PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME MoleculeFile COMMAND test_molecule_file WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(test_pair_unit_convert test_pair_unit_convert.cpp)
|
||||
target_link_libraries(test_pair_unit_convert PRIVATE lammps gmock)
|
||||
target_link_libraries(test_pair_unit_convert PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME PairUnitConvert COMMAND test_pair_unit_convert WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_tests_properties(PairUnitConvert PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
||||
|
||||
add_executable(test_potential_file_reader test_potential_file_reader.cpp)
|
||||
target_link_libraries(test_potential_file_reader PRIVATE lammps gmock)
|
||||
target_link_libraries(test_potential_file_reader PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME PotentialFileReader COMMAND test_potential_file_reader WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_tests_properties(PotentialFileReader PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
||||
|
||||
if(PKG_MANYBODY)
|
||||
add_executable(test_eim_potential_file_reader test_eim_potential_file_reader.cpp)
|
||||
target_link_libraries(test_eim_potential_file_reader PRIVATE lammps gmock)
|
||||
target_link_libraries(test_eim_potential_file_reader PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME EIMPotentialFileReader COMMAND test_eim_potential_file_reader WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_tests_properties(EIMPotentialFileReader PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
||||
endif()
|
||||
|
||||
add_executable(test_text_file_reader test_text_file_reader.cpp)
|
||||
target_link_libraries(test_text_file_reader PRIVATE lammps gmock)
|
||||
target_link_libraries(test_text_file_reader PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME TextFileReader COMMAND test_text_file_reader WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_tests_properties(TextFileReader PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
||||
|
||||
add_executable(test_file_operations test_file_operations.cpp)
|
||||
target_link_libraries(test_file_operations PRIVATE lammps gmock)
|
||||
target_link_libraries(test_file_operations PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME FileOperations COMMAND test_file_operations WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(test_dump_atom test_dump_atom.cpp)
|
||||
target_link_libraries(test_dump_atom PRIVATE lammps gmock)
|
||||
target_link_libraries(test_dump_atom PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME DumpAtom COMMAND test_dump_atom WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_tests_properties(DumpAtom PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
||||
|
||||
|
@ -50,19 +50,19 @@ if(PKG_COMPRESS)
|
|||
find_program(GZIP_BINARY NAMES gzip REQUIRED)
|
||||
|
||||
add_executable(test_dump_atom_compressed test_dump_atom_compressed.cpp compressed_dump_test_main.cpp)
|
||||
target_link_libraries(test_dump_atom_compressed PRIVATE lammps gmock)
|
||||
target_link_libraries(test_dump_atom_compressed PRIVATE lammps GTest::GMock)
|
||||
|
||||
add_executable(test_dump_custom_compressed test_dump_custom_compressed.cpp compressed_dump_test_main.cpp)
|
||||
target_link_libraries(test_dump_custom_compressed PRIVATE lammps gmock)
|
||||
target_link_libraries(test_dump_custom_compressed PRIVATE lammps GTest::GMock)
|
||||
|
||||
add_executable(test_dump_cfg_compressed test_dump_cfg_compressed.cpp compressed_dump_test_main.cpp)
|
||||
target_link_libraries(test_dump_cfg_compressed PRIVATE lammps gmock)
|
||||
target_link_libraries(test_dump_cfg_compressed PRIVATE lammps GTest::GMock)
|
||||
|
||||
add_executable(test_dump_local_compressed test_dump_local_compressed.cpp compressed_dump_test_main.cpp)
|
||||
target_link_libraries(test_dump_local_compressed PRIVATE lammps gmock)
|
||||
target_link_libraries(test_dump_local_compressed PRIVATE lammps GTest::GMock)
|
||||
|
||||
add_executable(test_dump_xyz_compressed test_dump_xyz_compressed.cpp compressed_dump_test_main.cpp)
|
||||
target_link_libraries(test_dump_xyz_compressed PRIVATE lammps gmock)
|
||||
target_link_libraries(test_dump_xyz_compressed PRIVATE lammps GTest::GMock)
|
||||
|
||||
add_test(NAME DumpAtomGZ COMMAND test_dump_atom_compressed gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_tests_properties(DumpAtomGZ PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${GZIP_BINARY}")
|
||||
|
@ -102,17 +102,17 @@ if(PKG_COMPRESS)
|
|||
endif()
|
||||
|
||||
add_executable(test_dump_custom test_dump_custom.cpp)
|
||||
target_link_libraries(test_dump_custom PRIVATE lammps gmock)
|
||||
target_link_libraries(test_dump_custom PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME DumpCustom COMMAND test_dump_custom WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_tests_properties(DumpCustom PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
||||
|
||||
add_executable(test_dump_cfg test_dump_cfg.cpp)
|
||||
target_link_libraries(test_dump_cfg PRIVATE lammps gmock)
|
||||
target_link_libraries(test_dump_cfg PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME DumpCfg COMMAND test_dump_cfg WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_tests_properties(DumpCfg PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
||||
|
||||
add_executable(test_dump_local test_dump_local.cpp)
|
||||
target_link_libraries(test_dump_local PRIVATE lammps gmock)
|
||||
target_link_libraries(test_dump_local PRIVATE lammps GTest::GMock)
|
||||
add_test(NAME DumpLocal COMMAND test_dump_local WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_tests_properties(DumpLocal PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@ if(CMAKE_Fortran_COMPILER)
|
|||
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_main)
|
||||
target_link_libraries(test_fortran_create PRIVATE flammps lammps MPI::MPI_Fortran 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_main)
|
||||
target_link_libraries(test_fortran_commands PRIVATE flammps lammps MPI::MPI_Fortran GTest::GTestMain)
|
||||
add_test(FortranCommands test_fortran_commands)
|
||||
else()
|
||||
message(STATUS "Skipping Tests for the LAMMPS Fortran Module: no Fortran compiler")
|
||||
|
|
|
@ -21,7 +21,7 @@ else()
|
|||
endif()
|
||||
|
||||
add_executable(test_python_package test_python_package.cpp)
|
||||
target_link_libraries(test_python_package PRIVATE lammps gmock)
|
||||
target_link_libraries(test_python_package PRIVATE lammps GTest::GMock)
|
||||
target_compile_definitions(test_python_package PRIVATE -DTEST_INPUT_FOLDER=${TEST_INPUT_FOLDER})
|
||||
# this requires CMake 3.12. don't care to add backward compatibility for this.
|
||||
if(Python3_Development_FOUND)
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
add_executable(test_tokenizer test_tokenizer.cpp)
|
||||
target_link_libraries(test_tokenizer PRIVATE lammps gmock_main)
|
||||
target_link_libraries(test_tokenizer PRIVATE lammps GTest::GMockMain)
|
||||
add_test(Tokenizer test_tokenizer)
|
||||
|
||||
add_executable(test_mempool test_mempool.cpp)
|
||||
target_link_libraries(test_mempool PRIVATE lammps gmock_main)
|
||||
target_link_libraries(test_mempool PRIVATE lammps GTest::GMockMain)
|
||||
add_test(MemPool test_mempool)
|
||||
|
||||
add_executable(test_argutils test_argutils.cpp)
|
||||
target_link_libraries(test_argutils PRIVATE lammps gmock_main)
|
||||
target_link_libraries(test_argutils PRIVATE lammps GTest::GMockMain)
|
||||
add_test(ArgUtils test_argutils)
|
||||
|
||||
add_executable(test_utils test_utils.cpp)
|
||||
target_link_libraries(test_utils PRIVATE lammps gmock_main)
|
||||
target_link_libraries(test_utils PRIVATE lammps GTest::GMockMain)
|
||||
add_test(Utils test_utils)
|
||||
|
||||
add_executable(test_platform test_platform.cpp)
|
||||
target_link_libraries(test_platform PRIVATE lammps gmock_main)
|
||||
target_link_libraries(test_platform PRIVATE lammps GTest::GMockMain)
|
||||
add_test(Platform test_platform)
|
||||
|
||||
set_tests_properties(Utils Platform PROPERTIES
|
||||
|
@ -34,7 +34,7 @@ if(BUILD_SHARED_LIBS)
|
|||
endif()
|
||||
|
||||
add_executable(test_fmtlib test_fmtlib.cpp)
|
||||
target_link_libraries(test_fmtlib PRIVATE lammps gmock_main)
|
||||
target_link_libraries(test_fmtlib PRIVATE lammps GTest::GMockMain)
|
||||
add_test(FmtLib test_fmtlib)
|
||||
|
||||
add_executable(test_math_eigen_impl test_math_eigen_impl.cpp)
|
||||
|
|
Loading…
Reference in New Issue