forked from lijiext/lammps
cmake: ninja-1.10 supports Fortran now
This commit is contained in:
parent
fa7085be07
commit
9f537f7f40
|
@ -587,10 +587,25 @@ if(BUILD_TOOLS)
|
||||||
add_executable(binary2txt ${LAMMPS_TOOLS_DIR}/binary2txt.cpp)
|
add_executable(binary2txt ${LAMMPS_TOOLS_DIR}/binary2txt.cpp)
|
||||||
install(TARGETS binary2txt DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS binary2txt DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
|
||||||
# ninja-build currently does not support fortran. thus we skip building this tool
|
# ninja-build<1.10 does not support fortran. thus we skip building this tool
|
||||||
if(CMAKE_GENERATOR STREQUAL "Ninja")
|
if(CMAKE_GENERATOR STREQUAL "Ninja")
|
||||||
message(STATUS "Skipping building 'chain.x' with Ninja build tool due to lack of Fortran support")
|
set(CMAKE_GENERATOR_SUPPORT_FORTRAN FALSE)
|
||||||
|
execute_process(COMMAND "${CMAKE_MAKE_PROGRAM}" --version
|
||||||
|
OUTPUT_VARIABLE NINJA_VERSION
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
RESULT_VARIABLE _Ninja_version_result
|
||||||
|
)
|
||||||
|
if(_Ninja_version_result)
|
||||||
|
message(WARNING "Unable to determine ninja version: ${_Ninja_version_result}")
|
||||||
|
elseif(NINJA_VERSION VERSION_LESS "1.10")
|
||||||
|
message(WARNING "Ninja build tool too old, skipping building 'chain.x' due to lack of Fortran support, please install ninja-1.10 or newer")
|
||||||
|
else()
|
||||||
|
set(CMAKE_GENERATOR_SUPPORT_FORTRAN TRUE)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
|
set(CMAKE_GENERATOR_SUPPORT_FORTRAN TRUE)
|
||||||
|
endif()
|
||||||
|
if(CMAKE_GENERATOR_SUPPORT_FORTRAN)
|
||||||
enable_language(Fortran)
|
enable_language(Fortran)
|
||||||
add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f)
|
add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f)
|
||||||
target_link_libraries(chain.x ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
target_link_libraries(chain.x ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES})
|
||||||
|
|
Loading…
Reference in New Issue