1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-30 21:51:12 +02:00

If fmt is not imported it must be installed

option(FMT_INSTALL "needed!" YES) # helps
This commit is contained in:
ClausKlein 2021-02-06 23:14:06 +01:00
parent e5c060387e
commit 48ab4e707d

View file

@ -38,6 +38,11 @@ CPMAddPackage(
VERSION 1.4
)
# NOTE: If fmt is not imported, this is needed to prevent:
# CMake Error: install(EXPORT "GreeterTargets" ...) includes target
# "Greeter" which requires target "fmt" that is not in any export set.
option(FMT_INSTALL "" YES)
CPMAddPackage(
NAME fmt
GIT_TAG 7.1.3
@ -66,8 +71,8 @@ target_sources(Greeter PRIVATE ${headers} ${sources})
# FIXME target_compile_options(Greeter PUBLIC "$<$<BOOL:${MSVC}>:/permissive->")
# Link dependencies (if required)
target_link_libraries(Greeter PUBLIC fmt::fmt-header-only)
# XXX target_link_libraries(Greeter PUBLIC fmt::fmt)
target_link_libraries(Greeter PRIVATE fmt::fmt-header-only)
#XXX target_link_libraries(Greeter PUBLIC fmt::fmt)
target_include_directories(
Greeter PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
@ -81,16 +86,13 @@ target_include_directories(
# header paths
string(TOLOWER ${PROJECT_NAME}/version.h VERSION_HEADER_LOCATION)
# FIXME: CMake Error: install(EXPORT "GreeterTargets" ...) includes target
# "Greeter" which requires target "fmt" that is not in any export set.
# packageProject(
# NAME ${PROJECT_NAME}
# VERSION ${PROJECT_VERSION}
# NAMESPACE ${PROJECT_NAME}
# BINARY_DIR ${PROJECT_BINARY_DIR}
# INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include
# INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION}
# VERSION_HEADER "${VERSION_HEADER_LOCATION}"
# # XXX DEPENDENCIES fmt
# )
packageProject(
NAME ${PROJECT_NAME}
VERSION ${PROJECT_VERSION}
NAMESPACE ${PROJECT_NAME}
BINARY_DIR ${PROJECT_BINARY_DIR}
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include
INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION}
VERSION_HEADER "${VERSION_HEADER_LOCATION}"
#XXX DEPENDENCIES fmt
)