Commit 6f5fcd66 authored by Christoph Junghans's avatar Christoph Junghans
Browse files

cmake: check flags in CMAKE_TUNE_FLAGS

parent 5c0e8a6b
Loading
Loading
Loading
Loading
+9 −3
Changes for cmake/CMakeLists.txt: 9 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -381,10 +381,16 @@ include(Packages/MSCG)
include(Packages/COMPRESS)

set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler specific optimization or instrumentation")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_TUNE_FLAGS}")
if(CMAKE_Fortran_COMPILER)
  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${CMAKE_TUNE_FLAGS}")
separate_arguments(CMAKE_TUNE_FLAGS)
include(CheckCXXCompilerFlag)
foreach(_FLAG ${CMAKE_TUNE_FLAGS})
  check_cxx_compiler_flag("${_FLAG}" COMPILER_SUPPORTS${_FLAG})
  if(COMPILER_SUPPORTS${_FLAG})
    target_compile_options(lammps PRIVATE ${_FLAG})
  else()
    message(WARNING "${_FLAG} found in CMAKE_TUNE_FLAGS, but not supported by the compiler, skipping")
  endif()
endforeach()
########################################################################
# Basic system tests (standard libraries, headers, functions, types)   #
########################################################################
+1 −1
Changes for cmake/Modules/Packages/USER-INTEL.cmake: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ if(PKG_USER-INTEL)
    if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
      include(CheckCXXCompilerFlag)
      foreach(_FLAG -O2 -fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high -qno-offload -fno-alias -ansi-alias -restrict)
        check_cxx_compiler_flag("${__FLAG}" COMPILER_SUPPORTS${_FLAG})
        check_cxx_compiler_flag("${_FLAG}" COMPILER_SUPPORTS${_FLAG})
        if(COMPILER_SUPPORTS${_FLAG})
	  target_compile_options(lammps PRIVATE ${_FLAG})
        endif()