-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
37 lines (31 loc) · 1.16 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
cmake_minimum_required(VERSION 2.8)
project(my_openmp_examples)
set(targetOptions "dotprod, matxvec_sparse, vector_add")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c++0x")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
if(DEBUG)
message("Debug is on")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb3")
endif(DEBUG)
include(FindOpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
if(${TARGET} STREQUAL "dotprod")
add_subdirectory(dotprod)
elseif(${TARGET} STREQUAL "matxvec_sparse")
add_subdirectory(matxvec_sparse)
elseif(${TARGET} STREQUAL "vector_add")
add_subdirectory(vector_add)
elseif(${TARGET} STREQUAL "all")
add_subdirectory(dotprod)
add_subdirectory(matxvec_sparse)
add_subdirectory(vector_add)
else()
message("ERROR: Please specify TARGET: 'all', 'dotprod', 'matxvec_sparse', 'vector_add'")
endif()
else(OPENMP_FOUND)
message("ERROR: OpenMP could not be found.")
endif(OPENMP_FOUND)