-
Notifications
You must be signed in to change notification settings - Fork 30
/
CMakeLists.txt
40 lines (30 loc) · 1.1 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
37
38
39
40
cmake_minimum_required(VERSION 2.8.12)
project(KnightKing)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(KTK_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
option(WITH_TESTS "Build unit test programs" OFF)
include(knightking.cmake)
find_package(OpenMP REQUIRED)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
find_package(MPI REQUIRED)
if(MPI_FOUND)
set(CMAKE_CXX_COMPILE_FLAGS ${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
set(CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS})
set(MPI_EXECUTABLE_SUFFIX .openmpi)
include_directories(${MPI_INCLUDE_PATH})
endif()
if(WITH_TESTS)
enable_testing()
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/ext/gtest/googletest/include")
add_subdirectory(ext/gtest)
link_directories(${CMAKE_BINARY_DIR}/lib)
set(GTEST_LIBRARIES "gtest" "gtest_main")
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${KTK_RUNTIME_OUTPUT_DIRECTORY})
include_directories(include)
include_directories(ext)
add_subdirectory(src)