Add defines to build Lepton with MSVC and CMake

This commit is contained in:
Giacomo Fiorin 2020-04-14 17:07:14 -04:00
parent be1f307384
commit 250e3892f8
1 changed files with 5 additions and 1 deletions

View File

@ -12,6 +12,8 @@ if(COLVARS_LEPTON)
if(NOT BUILD_SHARED_LIBS)
install(TARGETS lepton EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
# Change the define below to LEPTON_BUILDING_SHARED_LIBRARY when linking Lepton as a DLL with MSVC
target_compile_definitions(lepton PRIVATE -DLEPTON_BUILDING_STATIC_LIBRARY)
set_target_properties(lepton PROPERTIES OUTPUT_NAME lammps_lepton${LAMMPS_MACHINE})
target_include_directories(lepton PRIVATE ${LEPTON_DIR}/include)
endif()
@ -27,6 +29,8 @@ target_link_libraries(lammps PRIVATE colvars)
if(COLVARS_LEPTON)
target_link_libraries(lammps PRIVATE lepton)
target_compile_options(colvars PRIVATE -DLEPTON)
target_compile_definitions(colvars PRIVATE -DLEPTON)
# Disable the line below when linking Lepton as a DLL with MSVC
target_compile_definitions(colvars PRIVATE -DLEPTON_USE_STATIC_LIBRARIES)
target_include_directories(colvars PUBLIC ${LEPTON_DIR}/include)
endif()