forked from lijiext/lammps
Ignore installed package files when using cmake
This commit is contained in:
parent
1a80d4bc13
commit
c9d41dbb47
|
@ -328,13 +328,32 @@ RegisterStyles(${LAMMPS_SOURCE_DIR})
|
|||
# add sources of enabled packages
|
||||
############################################
|
||||
foreach(PKG ${DEFAULT_PACKAGES} ${OTHER_PACKAGES})
|
||||
if(ENABLE_${PKG})
|
||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||
|
||||
# ignore PKG files which were manually installed in src folder
|
||||
# headers are ignored during RegisterStyles
|
||||
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/*.cpp)
|
||||
file(GLOB ${PKG}_HEADERS ${${PKG}_SOURCES_DIR}/*.h)
|
||||
|
||||
foreach(PKG_FILE in ${${PKG}_SOURCES})
|
||||
get_filename_component(FNAME ${PKG_FILE} NAME)
|
||||
list(FIND LIB_SOURCES ${LAMMPS_SOURCE_DIR}/${FNAME} IDX)
|
||||
|
||||
if(NOT (IDX LESS 0))
|
||||
#message("Ignoring ${PKG_FILE}...")
|
||||
list(REMOVE_AT LIB_SOURCES ${IDX})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(PKG_FILE in ${${PKG}_HEADERS})
|
||||
get_filename_component(FNAME ${PKG_FILE} NAME)
|
||||
DetectAndRemovePackageHeader(${LAMMPS_SOURCE_DIR}/${FNAME})
|
||||
endforeach()
|
||||
|
||||
if(ENABLE_${PKG})
|
||||
# detects styles in package and adds them to global list
|
||||
RegisterStyles(${${PKG}_SOURCES_DIR})
|
||||
|
||||
file(GLOB ${PKG}_SOURCES ${${PKG}_SOURCES_DIR}/*.cpp)
|
||||
list(APPEND LIB_SOURCES ${${PKG}_SOURCES})
|
||||
include_directories(${${PKG}_SOURCES_DIR})
|
||||
endif()
|
||||
|
|
|
@ -85,6 +85,40 @@ function(RegisterStyles search_path)
|
|||
FindStyleHeaders(${search_path} REGION_CLASS region_ REGION ) # region ) # domain
|
||||
endfunction(RegisterStyles)
|
||||
|
||||
function(RemovePackageHeader headers pkg_header)
|
||||
get_property(hlist GLOBAL PROPERTY ${headers})
|
||||
|
||||
list(FIND hlist ${pkg_header} idx)
|
||||
if(NOT (idx LESS 0))
|
||||
list(REMOVE_AT hlist ${idx})
|
||||
#message("Ignoring ${pkg_header}...")
|
||||
set_property(GLOBAL PROPERTY ${headers} "${hlist}")
|
||||
endif()
|
||||
endfunction(RemovePackageHeader)
|
||||
|
||||
function(DetectAndRemovePackageHeader fname)
|
||||
RemovePackageHeader(ANGLE ${fname})
|
||||
RemovePackageHeader(ATOM_VEC ${fname})
|
||||
RemovePackageHeader(BODY ${fname})
|
||||
RemovePackageHeader(BOND ${fname})
|
||||
RemovePackageHeader(COMMAND ${fname})
|
||||
RemovePackageHeader(COMPUTE ${fname})
|
||||
RemovePackageHeader(DIHEDRAL ${fname})
|
||||
RemovePackageHeader(DUMP ${fname})
|
||||
RemovePackageHeader(FIX ${fname})
|
||||
RemovePackageHeader(IMPROPER ${fname})
|
||||
RemovePackageHeader(INTEGRATE ${fname})
|
||||
RemovePackageHeader(KSPACE ${fname})
|
||||
RemovePackageHeader(MINIMIZE ${fname})
|
||||
RemovePackageHeader(NBIN ${fname})
|
||||
RemovePackageHeader(NPAIR ${fname})
|
||||
RemovePackageHeader(NSTENCIL ${fname})
|
||||
RemovePackageHeader(NTOPO ${fname})
|
||||
RemovePackageHeader(PAIR ${fname})
|
||||
RemovePackageHeader(READER ${fname})
|
||||
RemovePackageHeader(REGION ${fname})
|
||||
endfunction(DetectAndRemovePackageHeader)
|
||||
|
||||
function(RegisterStylesExt search_path extension sources)
|
||||
FindStyleHeadersExt(${search_path} ANGLE_CLASS ${extension} ANGLE ${sources})
|
||||
FindStyleHeadersExt(${search_path} ATOM_CLASS ${extension} ATOM_VEC ${sources})
|
||||
|
|
Loading…
Reference in New Issue