Commit fdd3d802 authored by Richard Berger's avatar Richard Berger
Browse files

Clean up CMakeList.txt by introducing LAMMPS_SOURCE_DIR variable

parent a86b0d4c
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.1)

project(lammps)
set(SOVERSION 0)
set(LAMMPS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../src)

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_C_FLAGS)
  #release comes with -O3 by default
@@ -29,8 +30,8 @@ if(ENABLE_MPI)
  include_directories(${MPI_C_INCLUDE_PATH})
  set(MPI_SOURCES)
else()
  file(GLOB MPI_SOURCES ${CMAKE_SOURCE_DIR}/../src/STUBS/mpi.c)
  include_directories(${CMAKE_SOURCE_DIR}/../src/STUBS)
  file(GLOB MPI_SOURCES ${LAMMPS_SOURCE_DIR}/STUBS/mpi.c)
  include_directories(${LAMMPS_SOURCE_DIR}/STUBS)
  set(MPI_CXX_LIBRARIES)
endif()

@@ -87,15 +88,15 @@ endforeach(FUNC)
#Do NOT go into src to not conflict with old Makefile build system
#add_subdirectory(src)

file(GLOB LIB_SOURCES ${CMAKE_SOURCE_DIR}/../src/*.cpp)
file(GLOB LMP_SOURCES ${CMAKE_SOURCE_DIR}/../src/main.cpp)
file(GLOB LIB_SOURCES ${LAMMPS_SOURCE_DIR}/*.cpp)
file(GLOB LMP_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp)
list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES})

foreach(PKG ${PACKAGES})
  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})
    include_directories(${CMAKE_SOURCE_DIR}/../src/${PKG})
    include_directories(${LAMMPS_SOURCE_DIR}/${PKG})
  endif()
endforeach()

@@ -105,7 +106,7 @@ if(ENABLE_REAX)
  list(APPEND LIB_SOURCES ${REAX_SOURCES})
  include_directories(${CMAKE_SOURCE_DIR}/../lib/reax)
endif()
include_directories(${CMAKE_SOURCE_DIR}/../src)
include_directories(${LAMMPS_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/Headers)
configure_file(${CMAKE_SOURCE_DIR}/Headers/package.h.cmakein ${CMAKE_BINARY_DIR}/cmake/package.h)
include_directories(${CMAKE_BINARY_DIR}/cmake)