Skip to content

Commit

Permalink
Correcting OpenMp flag : pull request #5
Browse files Browse the repository at this point in the history
  • Loading branch information
Goul-tard committed Nov 8, 2024
1 parent 94aaa09 commit 9892845
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,18 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-g -fsanitize=address,undefined")

# include_directories(include)
# OpenMP
find_package(OpenMP)
if (OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(LINK_LIBS ${LINK_LIBS} OpenMP::OpenMP_CXX)
endif()

# Eigen
find_package(Eigen3 3.3 REQUIRED NO_MODULE)
set(LINK_LIBS ${LINK_LIBS} Eigen3::Eigen)


# Executables
add_executable(main examples/main.cpp) # create an executable using the specified file
target_link_libraries(main PUBLIC ${LINK_LIBS})

add_executable(matrix_eigen examples/matrix_eigen.cpp) # create an executable using the specified file
target_link_libraries(matrix_eigen PUBLIC ${LINK_LIBS})

find_package(OpenMP)
add_executable(loop_omp examples/loop_omp.cpp) # create an executable using the specified file
target_compile_options(loop_omp PRIVATE ${OpenMP_CXX_FLAGS})
target_link_libraries(loop_omp PUBLIC ${LINK_LIBS})
target_link_libraries(loop_omp PUBLIC ${LINK_LIBS} OpenMP::OpenMP_CXX)

0 comments on commit 9892845

Please sign in to comment.