CMake has a standard module for testing if the compiler supports OpenMP.
1 2 3 4 5 6 7 8 9
| cmake_minimum_required(VERSION 3.17) project(OpenMPTest)
set(CMAKE_CXX_STANDARD 20)
add_executable(${PROJECT_NAME} main.cpp)
find_package(OpenMP REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE OpenMP::OpenMP_CXX)
|