How to configure CMakeLists.txt for OpenMP?

Viewed 1014

I am building a python extension from c++ shared library. This library is using some openmp pragma.

I would like to know how to configure CMakeLists.txt in order to include openmp ? I have added the openmp flag -fopenmp But I still have this error : undefined symbol: GOMP_critical_end

here is my CMakeLists.txt file

cmake_minimum_required(VERSION 3.10)

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++lastest -pthread -fopenmp") 

project (py_interface)

#find_library('gomp')
find_package(OpenMP REQUIRED)
find_package(Boost REQUIRED) 

include_directories(/usr/include/python3.6/)

link_directories(/usr/local/lib)

set(SRC interface.cpp)

add_library(py_interface SHARED ${SRC})

target_link_libraries(py_interface PRIVATE OpenMP::OpenMP_CXX ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})

set_property(TARGET py_interface PROPERTY POSITION_INDEPENDENT_CODE ON)
0 Answers
Related