Skip to content

Commit

Permalink
make fmt optional for the llama target
Browse files Browse the repository at this point in the history
Fixes #382.
  • Loading branch information
bernhardmgruber committed Sep 27, 2021
1 parent 905986a commit ee8b14b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ project (llama CXX)

# llama
find_package(Boost 1.70.0 REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(fmt CONFIG QUIET)
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
target_link_libraries(${PROJECT_NAME} INTERFACE Boost::headers fmt::fmt)
target_link_libraries(${PROJECT_NAME} INTERFACE Boost::headers)
if (fmt_FOUND)
target_link_libraries(${PROJECT_NAME} INTERFACE fmt::fmt)
else()
message("The fmt library was not found. You cannot use llama/DumpMapping.hpp")
endif()

# llama::llama to make subdirectory projects work
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
Expand Down
4 changes: 4 additions & 0 deletions include/llama/DumpMapping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

#pragma once

#if !__has_include(<fmt/format.h>)
# error DumpMapping.hpp requires the fmt library
#endif

#include "ArrayDimsIndexRange.hpp"
#include "Core.hpp"

Expand Down

0 comments on commit ee8b14b

Please sign in to comment.