forked from lijiext/lammps
cmake: fix install
This commit is contained in:
parent
0a6e9c8bf6
commit
54f2b02ac8
|
@ -26,6 +26,7 @@ include(CheckCCompilerFlag)
|
|||
# User input options #
|
||||
########################################################################
|
||||
option(BUILD_SHARED_LIBS "Build shared libs" OFF)
|
||||
option(INSTALL_LIB "Install lammps library and header" ON)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(LAMMPS_LINK_LIBS)
|
||||
|
@ -165,11 +166,16 @@ include_directories(${LAMMPS_STYLE_HEADERS_DIR})
|
|||
add_library(lammps ${LIB_SOURCES})
|
||||
target_link_libraries(lammps ${LAMMPS_LINK_LIBS})
|
||||
set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION})
|
||||
install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
if(INSTALL_LIB)
|
||||
install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(FILES ${LAMMPS_SOURCE_DIR}/lammps.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
elseif(NOT BUILD_SHARED_LIBS)
|
||||
message(FATAL_ERROR "Shared library has to install, use -DBUILD_SHARED_LIBS=OFF to install lammps with a a library")
|
||||
endif()
|
||||
|
||||
add_executable(lmp ${LMP_SOURCES})
|
||||
target_link_libraries(lmp lammps)
|
||||
install(TARGETS lammps DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(TARGETS lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
foreach(PKG ${PACKAGES} ${ACCEL_PACKAGES})
|
||||
if(ENABLE_${PKG})
|
||||
|
|
|
@ -24,7 +24,7 @@ function(CreateStyleHeader path filename)
|
|||
set(temp "${temp}#include \"${FNAME}\"\n")
|
||||
endforeach()
|
||||
endif()
|
||||
message("Generating ${filename}...")
|
||||
message(STATUS "Generating ${filename}...")
|
||||
file(WRITE "${path}/${filename}" "${temp}" )
|
||||
endfunction(CreateStyleHeader)
|
||||
|
||||
|
|
Loading…
Reference in New Issue