1
0
mirror of https://github.com/rd235/cado synced 2024-12-27 06:24:11 +01:00

Fix CADO_SPOOL_DIR path and change PostInstall flag

This commit is contained in:
Mattia Biondi 2020-05-03 15:34:22 +02:00
parent 8cadce02ae
commit 792020b65d
2 changed files with 38 additions and 35 deletions

View File

@ -1,34 +1,37 @@
cmake_minimum_required(VERSION 3.13) cmake_minimum_required(VERSION 3.13)
project(cado project(cado
VERSION 0.9.4 VERSION 0.9.4
DESCRIPTION "Capability Ambient DO. Provide users just the capabilities they need." DESCRIPTION "Capability Ambient DO. Provide users just the capabilities they need."
HOMEPAGE_URL "https://github.com/rd235/cado" HOMEPAGE_URL "https://github.com/rd235/cado"
LANGUAGES C) LANGUAGES C)
include(GNUInstallDirs) include(GNUInstallDirs)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=2 -O2 -Wall -pedantic") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=2 -O2 -Wall -pedantic")
set(LIBS_REQUIRED cap execs mhash pam pam_misc) set(LIBS_REQUIRED cap execs mhash pam pam_misc)
option(CADO_RUN_POST_INSTALL "Run PostInstall.cmake" ON)
foreach(THISLIB IN LISTS LIBS_REQUIRED) foreach(THISLIB IN LISTS LIBS_REQUIRED)
find_library(${THISLIB}_library ${THISLIB}) find_library(${THISLIB}_library ${THISLIB})
if(NOT ${THISLIB}_library) if(NOT ${THISLIB}_library)
message(FATAL_ERROR "library lib${THISLIB} not found") message(FATAL_ERROR "library lib${THISLIB} not found")
endif() endif()
endforeach(THISLIB) endforeach(THISLIB)
if (WITHEDITOR) if (WITHEDITOR)
set(EDITOR "${WITHEDITOR}") set(EDITOR "${WITHEDITOR}")
else (WITHEDITOR) else (WITHEDITOR)
set(EDITOR "/usr/bin/vi") set(EDITOR "/usr/bin/vi")
endif (WITHEDITOR) endif (WITHEDITOR)
# Spool dir for scado files # Spool dir for scado files
set(CADO_SPOOL_DIR "/usr/local/var/spool/cado") set(CADO_SPOOL_DIR
"${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/spool/${CMAKE_PROJECT_NAME}")
configure_file( configure_file(
"include/config.h.in" "include/config.h.in"
"include/config.h" "include/config.h"
) )
add_subdirectory(man) add_subdirectory(man)

View File

@ -1,27 +1,27 @@
cmake_minimum_required(VERSION 3.13) cmake_minimum_required(VERSION 3.13)
add_executable( add_executable(
cado cado.c pam_check.c get_user_groups.c capset_from_namelist.c cado cado.c pam_check.c get_user_groups.c capset_from_namelist.c
read_conf.c set_ambient_cap.c compute_digest.c file_utils.c read_conf.c set_ambient_cap.c compute_digest.c file_utils.c
scado_parse.c cado_scado_check.c scado_parse.c cado_scado_check.c
) )
target_include_directories(cado PRIVATE ${PROJECT_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include) target_include_directories(cado PRIVATE ${PROJECT_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include)
target_link_libraries( target_link_libraries(
cado ${pam_library} ${pam_misc_library} ${cap_library} ${mhash_library} cado ${pam_library} ${pam_misc_library} ${cap_library} ${mhash_library}
${execs_library}) ${execs_library})
add_executable(cadrop cadrop.c capset_from_namelist.c set_ambient_cap.c) add_executable(cadrop cadrop.c capset_from_namelist.c set_ambient_cap.c)
target_include_directories(cadrop PRIVATE ${PROJECT_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include) target_include_directories(cadrop PRIVATE ${PROJECT_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include)
target_link_libraries(cadrop ${cap_library}) target_link_libraries(cadrop ${cap_library})
add_executable( add_executable(
scado scado.c pam_check.c file_utils.c compute_digest.c scado scado.c pam_check.c file_utils.c compute_digest.c
capset_from_namelist.c scado_parse.c capset_from_namelist.c scado_parse.c
) )
target_include_directories(scado PRIVATE ${PROJECT_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include) target_include_directories(scado PRIVATE ${PROJECT_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include)
target_link_libraries( target_link_libraries(
scado ${pam_library} ${pam_misc_library} ${cap_library} ${mhash_library} scado ${pam_library} ${pam_misc_library} ${cap_library} ${mhash_library}
${execs_library} ${execs_library}
) )
add_executable(caprint caprint.c) add_executable(caprint caprint.c)
@ -29,19 +29,19 @@ target_include_directories(caprint PRIVATE ${PROJECT_SOURCE_DIR}/include ${CMAKE
target_link_libraries(caprint ${cap_library}) target_link_libraries(caprint ${cap_library})
install( install(
TARGETS cado cadrop scado caprint TARGETS cado cadrop scado caprint
RUNTIME RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR} DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
if(NOT DEBUILD) if(CADO_RUN_POST_INSTALL)
install( install(
CODE "execute_process( CODE "execute_process(
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-DBINDIR=${CMAKE_INSTALL_FULL_BINDIR} -DBINDIR=${CMAKE_INSTALL_FULL_BINDIR}
-DLIBDIR=${CMAKE_INSTALL_FULL_LIBDIR} -DLIBDIR=${CMAKE_INSTALL_FULL_LIBDIR}
-DCADO_SPOOL_DIR=${CADO_SPOOL_DIR} -DCADO_SPOOL_DIR=${CADO_SPOOL_DIR}
-P ${PROJECT_SOURCE_DIR}/PostInstall.cmake -P ${PROJECT_SOURCE_DIR}/PostInstall.cmake
)" )"
) )
endif() endif()