USER-INTEL.cmake: add_compile_options -> target_compile_options

This commit is contained in:
Christoph Junghans 2020-04-03 14:24:27 -06:00
parent 9df26bca55
commit 1daa4ce374
2 changed files with 4 additions and 4 deletions

View File

@ -73,7 +73,7 @@ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
option(ENABLE_COVERAGE "Enable collecting code coverage data" OFF)
mark_as_advanced(ENABLE_COVERAGE)
if(ENABLE_COVERAGE)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set (CMAK_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
endif()
endif()

View File

@ -70,7 +70,7 @@ if(PKG_USER-INTEL)
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -xHost -qopenmp -qoffload")
set(MIC_OPTIONS "-qoffload-option,mic,compiler,\"-fp-model fast=2 -mGLOB_default_function_attrs=\\\"gather_scatter_loop_unroll=4\\\"\"")
add_compile_options(-xMIC-AVX512 -qoffload -fno-alias -ansi-alias -restrict -qoverride-limits ${MIC_OPTIONS})
target_compile_options(lammps PRIVATE -xMIC-AVX512 -qoffload -fno-alias -ansi-alias -restrict -qoverride-limits ${MIC_OPTIONS})
target_compile_definitions(lammps PRIVATE -DLMP_INTEL_OFFLOAD)
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
@ -78,11 +78,11 @@ if(PKG_USER-INTEL)
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})
if(COMPILER_SUPPORTS${_FLAG})
add_compile_options(${_FLAG})
target_compile_options(lammps PRIVATE ${_FLAG})
endif()
endforeach()
else()
add_compile_options(-O3 -ffast-math)
target_compile_options(lammps PRIVATE -O3 -ffast-math)
endif()
endif()