mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-11 17:29:30 +08:00
28 lines
1.2 KiB
CMake
28 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION 3.14)
|
|
project(info VERSION 0.0.0 LANGUAGES CXX)
|
|
enable_testing()
|
|
include(GNUInstallDirs)
|
|
|
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
message("Setting build type to 'Release' as none was specified.")
|
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
|
endif()
|
|
|
|
find_package(biu REQUIRED)
|
|
find_path(SLURM_INCLUDE_PATH slurm/spank.h REQUIRED)
|
|
find_library(SLURM_LIBRARY slurm REQUIRED)
|
|
find_package(Boost REQUIRED COMPONENTS process)
|
|
|
|
add_executable(info src/main.cpp)
|
|
target_include_directories(info PRIVATE ${SLURM_INCLUDE_PATH})
|
|
target_link_libraries(info PRIVATE biu::biu ${SLURM_LIBRARY} Boost::process)
|
|
target_compile_features(info PRIVATE cxx_std_23)
|
|
target_compile_definitions(info PRIVATE INFO_CONFIG_FILE="${INFO_CONFIG_FILE}")
|
|
install(TARGETS info RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
|
get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
|
|
message("Imported targets: ${ImportedTargets}")
|
|
message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}")
|
|
message("CMake build type: ${CMAKE_BUILD_TYPE}")
|