forked from hirschsn/kdpart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
42 lines (33 loc) · 1.12 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
41
42
cmake_minimum_required(VERSION 3.0)
project(KDPart)
# Default build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Include MPI
find_package(MPI REQUIRED)
include_directories(SYSTEM ${MPI_INCLUDE_PATH})
# Include C++ file(s)
file(GLOB SOURCES
util/*.cc
)
# Build shared library
add_library(kdpart SHARED kdpart.cc)
target_link_libraries(kdpart ${MPI_LIBRARIES} ${SOURCES})
# Build static library
add_library(kdpart_static STATIC kdpart.cc)
target_link_libraries(kdpart_static ${MPI_LIBRARIES} ${SOURCES})
set_target_properties(kdpart_static PROPERTIES OUTPUT_NAME kdpart)
# Build test
add_executable(kdpart_test_par kdpart_test_par.cc)
target_link_libraries(kdpart_test_par kdpart_static)
# Tests
enable_testing()
add_test(TestKDPart ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/kdpart_test_par)
# Install
install(TARGETS kdpart DESTINATION lib)
install(TARGETS kdpart_static DESTINATION lib)
install(FILES kdpart.h DESTINATION include)