Unverified Commit d0160cc2 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1915 from akohlmey/cpp-11-cmake-3.10

Require C++11 and CMake 3.10
parents 6354777d ec87a51a
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
# CMake build system
# This file is part of LAMMPS
# Created by Christoph Junghans and Richard Berger
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.10)

project(lammps CXX)
set(SOVERSION 0)
@@ -55,12 +55,9 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict -std=c++11")
endif()

option(DISABLE_CXX11_REQUIREMENT "Disable check that requires C++11 for compiling LAMMPS" OFF)
if(DISABLE_CXX11_REQUIREMENT)
  add_definitions(-DLAMMPS_CXX98)
# else()
#  set(CMAKE_CXX_STANDARD 11)
endif()
# we require C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# GNU compiler features
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
@@ -355,9 +352,6 @@ endforeach(HEADER)
set(MATH_LIBRARIES "m" CACHE STRING "math library")
mark_as_advanced( MATH_LIBRARIES )
include(CheckLibraryExists)
if (CMAKE_VERSION VERSION_LESS "3.4")
  enable_language(C) # check_library_exists isn't supported without a C compiler before v3.4
endif()
# RB: disabled this check because it breaks with KOKKOS CUDA enabled
#foreach(FUNC sin cos)
#  check_library_exists(${MATH_LIBRARIES} ${FUNC} "" FOUND_${FUNC}_${MATH_LIBRARIES})
+0 −3
Original line number Diff line number Diff line
if(PKG_GPU)
    if (CMAKE_VERSION VERSION_LESS "3.1")
      message(FATAL_ERROR "For the GPU package you need at least cmake-3.1")
    endif()
    set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU)
    set(GPU_SOURCES ${GPU_SOURCES_DIR}/gpu_extra.h
                    ${GPU_SOURCES_DIR}/fix_gpu.h
+0 −3
Original line number Diff line number Diff line
@@ -8,9 +8,6 @@ if(PKG_LATTE)
  endif()
  option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" ${DOWNLOAD_LATTE_DEFAULT})
  if(DOWNLOAD_LATTE)
    if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR
      message(FATAL_ERROR "For downlading LATTE you need at least cmake-3.7")
    endif()
    if(CMAKE_GENERATOR STREQUAL "Ninja")
      message(FATAL_ERROR "Cannot build downloaded LATTE library with Ninja build tool")
    endif()
+0 −3
Original line number Diff line number Diff line
@@ -8,9 +8,6 @@ if(PKG_MSCG)
  endif()
  option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" ${DOWNLOAD_MSCG_DEFAULT})
  if(DOWNLOAD_MSCG)
    if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR
      message(FATAL_ERROR "For downlading MSCG you need at least cmake-3.7")
    endif()
    if(CMAKE_GENERATOR STREQUAL "Ninja")
      message(FATAL_ERROR "Cannot build downloaded MSCG library with Ninja build tool")
    endif()
+0 −4
Original line number Diff line number Diff line
if(PKG_USER-MOLFILE)
  if (CMAKE_VERSION VERSION_LESS "3.10") # due to INTERFACE without a library
    message(FATAL_ERROR "For configuring USER-MOLFILE you need CMake 3.10 or later")
  endif()

  set(MOLFILE_INCLUDE_DIRS "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers")
  add_library(molfile INTERFACE)
  target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS})
Loading