-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
95 lines (74 loc) · 2.51 KB
/
Copy pathCMakeLists.txt
File metadata and controls
95 lines (74 loc) · 2.51 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
cmake_minimum_required(VERSION 3.2)
project(lemon C CXX)
set(LEMON_VERSION 0.3.0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
option(BUILD_SHARED_LIBS "Link lemon programs dynamically" ON)
option(LEMON_TEST_ASYNC "Build an additional test for async parallelism" OFF)
option(LEMON_BUILD_DOCS "Build documentation" OFF)
option(LEMON_BENCHMARK "Should the programs be benchmarked?" OFF)
option(LEMON_BUILD_PROGS "Should the tests and other programs be built?" ON)
option(LEMON_BUILD_PYTHON "Build Python support" OFF)
option(LEMON_EXTERNAL_CHEMFILES "Should we use an external chemfiles?" OFF)
if (${LEMON_EXTERNAL_CHEMFILES})
find_package(chemfiles REQUIRED)
else()
include(InstallChemfiles)
endif()
include(CompilerFlags)
#----------------------------------------------------------------------------------------#
# Installation configuration
#----------------------------------------------------------------------------------------#
add_library(lemon INTERFACE)
install(TARGETS lemon EXPORT lemon-targets
INCLUDES DESTINATION include
)
target_include_directories(lemon INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
if (MSVC)
target_link_libraries(lemon INTERFACE chemfiles ws2_32)
else()
target_link_libraries(lemon INTERFACE chemfiles pthread)
endif()
install(DIRECTORY include/ DESTINATION include)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/lemon-config-version.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/lemon-config-version.cmake"
@ONLY
)
# Install package files
set(PACKAGE_LOCATION lib${LIB_SUFFIX}/cmake/lemon)
install(EXPORT lemon-targets
FILE lemon-targets.cmake
DESTINATION ${PACKAGE_LOCATION}
)
install(FILES
cmake/lemon-config.cmake
"${CMAKE_CURRENT_BINARY_DIR}/lemon-config-version.cmake"
DESTINATION ${PACKAGE_LOCATION}
COMPONENT Devel
)
# uninstall target
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/uninstall.in.cmake"
"${PROJECT_BINARY_DIR}/uninstall.cmake"
@ONLY
)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/uninstall.cmake
)
if (${LEMON_BUILD_DOCS})
add_subdirectory(doc)
endif()
if (${LEMON_BUILD_PROGS})
enable_testing()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/launch_lemon.pbs.in"
"${CMAKE_CURRENT_BINARY_DIR}/launch_lemon.pbs"
@ONLY
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/launch_lemon.pbs" DESTINATION bin)
add_subdirectory(progs)
add_subdirectory(test)
endif()
add_subdirectory(lang)