Permalink
Switch branches/tags
Nothing to show
Find file Copy path
1b0d962 Mar 26, 2012
1 contributor

Users who have contributed to this file

38 lines (31 sloc) 1.16 KB
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)