Skip to content

Commit

Permalink
Bugfix OpenMP with Visual Studio (#3475)
Browse files Browse the repository at this point in the history
* Bugfix OpenMP with Visual Studio

* Test for working VS2019 update instead of first version of VS2019
  • Loading branch information
OgreTransporter authored Jun 29, 2021
1 parent a701454 commit 4d0f027
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

This comment has been minimized.

Copy link
@nocun

nocun Jun 29, 2021

Contributor

This check fails in Linux:

CMake Error at CMakeLists.txt:259 (if):
  if given arguments:

    "OPENMP_BUILD" "AND" "MSVC" "AND" "LESS" "1929"

  Unknown arguments specified

MSVC and MSVC_VERSION are undefined (although looks like only MSVC_VERSION is the problem)

set(OPENMP_BUILD OFF)
endif()
if (OPENMP_BUILD)
find_package(OpenMP QUIET)
if (OpenMP_FOUND)
Expand All @@ -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)
Expand Down

0 comments on commit 4d0f027

Please sign in to comment.