Bugfix OpenMP with Visual Studio (#3475)

* Bugfix OpenMP with Visual Studio

* Test for working VS2019 update instead of first version of VS2019
This commit is contained in:
OgreTransporter 2021-06-29 20:06:38 +02:00 committed by GitHub
parent a701454ae5
commit 4d0f027f58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -256,6 +256,9 @@ if(CLANG) # clang all platforms
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -DDEBUG -pedantic -O0")
endif()
if (OPENMP_BUILD AND MSVC AND ${MSVC_VERSION} LESS 1929)
set(OPENMP_BUILD OFF)
endif()
if (OPENMP_BUILD)
find_package(OpenMP QUIET)
if (OpenMP_FOUND)
@ -280,6 +283,10 @@ if (OPENMP_BUILD)
set(OpenMP_FOUND 1)
add_definitions(-D_OPENMP=201107) # 3.1 version is supported from Clang 3.8.0
endif()
if (MSVC)
string(REPLACE "/openmp" "/openmp:llvm" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REPLACE "-openmp" "/openmp:llvm" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
endif()
endif()
if (CYGWIN)