added option to enable or disable use of openmp

This commit is contained in:
Krishna Vedala 2020-04-07 00:24:13 -04:00
parent 1e7fc84c3a
commit d24b6ea344
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7
2 changed files with 10 additions and 1 deletions

View File

@ -5,6 +5,8 @@ project(Algorithms_in_C
DESCRIPTION "Set of algorithms implemented in C."
)
option(USE_OPENMP "flag to use OpenMP for multithreading" ON)
add_subdirectory(function_timer EXCLUDE_FROM_ALL)
include_directories(function_timer/include)
# link_libraries(function_timer)
@ -13,8 +15,11 @@ include_directories(function_timer/include)
add_subdirectory(conversions)
add_subdirectory(misc)
add_subdirectory(project_euler)
find_package(OpenMP)
if(USE_OPENMP)
find_package(OpenMP)
endif()
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})

View File

@ -1,3 +1,7 @@
if(USE_OPENMP)
find_package(OpenMP)
endif()
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
# with full pathname. RELATIVE may makes it easier to extract an executable name
# automatically.