Edit CMake build to allow for clang compiler

This commit is contained in:
Gian Giacomo Guerreschi 2021-02-16 09:28:32 -08:00
parent 2640d573eb
commit 472bc6b5d4
1 changed files with 17 additions and 0 deletions

View File

@ -237,7 +237,22 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel)
$ENV{MKLROOT}/lib/intel64/libmkl_core.a
-Wl,--end-group -liomp5 -lpthread -lm -ldl)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES Clang)
# Ad-hoc modifications to compile and link with clang++.
add_compile_options(-O3)
add_compile_options(-m64)
if (IqsMKL)
message(FATAL_ERROR "Currently, the code does not provide MKL support with clang.")
endif()
if (IqsMPI)
message(FATAL_ERROR "Currently, the code does not provide MPI support with clang.")
endif()
link_libraries( -lgomp -lpthread -lm -ldl)
link_libraries( -lstdc++)
else()
message(STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
message(FATAL_ERROR "Currently, unsupported compiler environment.")
endif()
@ -250,6 +265,8 @@ if (OpenMP_CXX_FOUND)
message(STATUS "OpenMP LIBS = ${OpenMP_CXX_LIBRARIES} FLAGS=${OpenMP_CXX_FLAGS}")
add_compile_options("${OpenMP_CXX_FLAGS}")
link_libraries("${OpenMP_CXX_LIBRARIES}")
elseif(CMAKE_CXX_COMPILER_ID MATCHES Clang)
message(STATUS "TODO: untested OpenMP with clang")
else()
message(FATAL_ERROR "Unable to locate OpenMP in any standard locations.")
endif()