correctly handle the situation that the build folder may have multiple libs downloaded
This commit is contained in:
@ -24,6 +24,24 @@ function(validate_option name values)
|
||||
endif()
|
||||
endfunction(validate_option)
|
||||
|
||||
# helper function for getting the most recently modified file or folder from a glob pattern
|
||||
function(get_newest_file path variable)
|
||||
file(GLOB _dirs ${path})
|
||||
set(_besttime 2000-01-01T00:00:00)
|
||||
set(_bestfile "<unknown>")
|
||||
foreach(_dir ${_dirs})
|
||||
file(TIMESTAMP ${_dir} _newtime)
|
||||
if(_newtime IS_NEWER_THAN _besttime)
|
||||
set(_bestfile ${_dir})
|
||||
set(_besttime ${_newtime})
|
||||
endif()
|
||||
endforeach()
|
||||
if(_bestfile STREQUAL "<unknown>")
|
||||
message(FATAL_ERROR "Could not find valid path at: ${path}")
|
||||
endif()
|
||||
set(${variable} ${_bestfile} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(get_lammps_version version_header variable)
|
||||
file(STRINGS ${version_header} line REGEX LAMMPS_VERSION)
|
||||
set(MONTHS x Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
|
||||
|
||||
@ -13,8 +13,8 @@ execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf libpace.tar.gz
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace)
|
||||
|
||||
file(GLOB lib-pace ${CMAKE_BINARY_DIR}/lammps-user-pace-*)
|
||||
# enforce building libyaml-cpp as static library and turn off optional features
|
||||
set(YAML_BUILD_SHARED_LIBS OFF)
|
||||
set(YAML_CPP_BUILD_CONTRIB OFF)
|
||||
|
||||
Reference in New Issue
Block a user