cmake: fix install

This commit is contained in:
Christoph Junghans 2017-07-14 18:33:27 -06:00
parent 0a6e9c8bf6
commit 54f2b02ac8
2 changed files with 9 additions and 3 deletions

View File

@ -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})

View File

@ -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)