-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
46 lines (36 loc) · 1.56 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
43
44
45
46
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(slurm-singularity-exec LANGUAGES CXX)
include(GNUInstallDirs)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()
option(INSTALL_PLUGSTACK_CONF "Whether to install a plugstack config" OFF)
set(SLURM_SYSCONFDIR /etc/slurm CACHE STRING "Slurm sysconfdir")
set(SLURM_PLUGSTACK_CONF_D ${SLURM_SYSCONFDIR}/plugstack.conf.d
CACHE STRING "Slurm plugstack conf dir")
set(PLUGIN_DEFAULT_ARG "" CACHE STRING "Plugin default= arg")
set(PLUGIN_BIND_ARG ${SLURM_SYSCONFDIR},/var/spool/slurm,/var/run/munge
CACHE STRING "Plugin bind= arg")
set(PLUGIN_EXTRA_ARGS "" CACHE STRING "Plugin args= arg")
find_path(SLURM_INCLUDE_DIR
NAMES spank.h
PATH_SUFFIXES slurm
REQUIRED)
set(target ${PROJECT_NAME})
add_library(${target} SHARED main.cpp)
set_target_properties(${target} PROPERTIES PREFIX "")
target_compile_features(${target} PRIVATE cxx_std_17)
target_include_directories(${target} PRIVATE ${SLURM_INCLUDE_DIR})
target_link_libraries(${target} PRIVATE -static-libstdc++ -static-libgcc)
install(TARGETS ${target} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
set(WRAPPER slurm-singularity-wrapper.sh)
install(FILES ${WRAPPER} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
set(plugstackconf singularity-exec.conf)
configure_file(${plugstackconf}.in ${plugstackconf} @ONLY)
if (INSTALL_PLUGSTACK_CONF)
install(FILES ${CMAKE_BINARY_DIR}/${plugstackconf} DESTINATION ${SLURM_PLUGSTACK_CONF_D})
endif()