Clean up CMakeList.txt by introducing LAMMPS_SOURCE_DIR variable
This commit is contained in:
@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.1)
|
|||||||
|
|
||||||
project(lammps)
|
project(lammps)
|
||||||
set(SOVERSION 0)
|
set(SOVERSION 0)
|
||||||
|
set(LAMMPS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../src)
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS)
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS)
|
||||||
#release comes with -O3 by default
|
#release comes with -O3 by default
|
||||||
@ -29,8 +30,8 @@ if(ENABLE_MPI)
|
|||||||
include_directories(${MPI_C_INCLUDE_PATH})
|
include_directories(${MPI_C_INCLUDE_PATH})
|
||||||
set(MPI_SOURCES)
|
set(MPI_SOURCES)
|
||||||
else()
|
else()
|
||||||
file(GLOB MPI_SOURCES ${CMAKE_SOURCE_DIR}/../src/STUBS/mpi.c)
|
file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.c)
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/../src/STUBS)
|
include_directories(${LAMMPS_SOURCE_DIR}/STUBS)
|
||||||
set(MPI_CXX_LIBRARIES)
|
set(MPI_CXX_LIBRARIES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -87,15 +88,15 @@ endforeach(FUNC)
|
|||||||
#Do NOT go into src to not conflict with old Makefile build system
|
#Do NOT go into src to not conflict with old Makefile build system
|
||||||
#add_subdirectory(src)
|
#add_subdirectory(src)
|
||||||
|
|
||||||
file(GLOB LIB_SOURCES ${CMAKE_SOURCE_DIR}/../src/*.cpp)
|
file(GLOB LIB_SOURCES ${LAMMPS_SOURCE_DIR}/*.cpp)
|
||||||
file(GLOB LMP_SOURCES ${CMAKE_SOURCE_DIR}/../src/main.cpp)
|
file(GLOB LMP_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp)
|
||||||
list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES})
|
list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES})
|
||||||
|
|
||||||
foreach(PKG ${PACKAGES})
|
foreach(PKG ${PACKAGES})
|
||||||
if(ENABLE_${PKG})
|
if(ENABLE_${PKG})
|
||||||
file(GLOB ${PKG}_SOURCES ${CMAKE_SOURCE_DIR}/../src/${PKG}/*.cpp)
|
file(GLOB ${PKG}_SOURCES ${LAMMPS_SOURCE_DIR}/${PKG}/*.cpp)
|
||||||
list(APPEND LIB_SOURCES ${${PKG}_SOURCES})
|
list(APPEND LIB_SOURCES ${${PKG}_SOURCES})
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/../src/${PKG})
|
include_directories(${LAMMPS_SOURCE_DIR}/${PKG})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
@ -105,7 +106,7 @@ if(ENABLE_REAX)
|
|||||||
list(APPEND LIB_SOURCES ${REAX_SOURCES})
|
list(APPEND LIB_SOURCES ${REAX_SOURCES})
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/../lib/reax)
|
include_directories(${CMAKE_SOURCE_DIR}/../lib/reax)
|
||||||
endif()
|
endif()
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/../src)
|
include_directories(${LAMMPS_SOURCE_DIR})
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/Headers)
|
include_directories(${CMAKE_SOURCE_DIR}/Headers)
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/Headers/package.h.cmakein ${CMAKE_BINARY_DIR}/cmake/package.h)
|
configure_file(${CMAKE_SOURCE_DIR}/Headers/package.h.cmakein ${CMAKE_BINARY_DIR}/cmake/package.h)
|
||||||
include_directories(${CMAKE_BINARY_DIR}/cmake)
|
include_directories(${CMAKE_BINARY_DIR}/cmake)
|
||||||
|
|||||||
Reference in New Issue
Block a user