Skip to content

Skip cmake targets inclusion if fmt::fmt already exists - #2907

Merged
vitaut merged 1 commit into
fmtlib:masterfrom
kieselnb:cmake-allow-find-package-after-add-subdirectory
May 27, 2022
Merged

vitaut merged 1 commit into
fmtlib:masterfrom
kieselnb:cmake-allow-find-package-after-add-subdirectory

Conversation

@kieselnb

Copy link
Copy Markdown
Contributor

This allows find_package(fmt) to succeed if fmt is included in a project via add_subdirectory. This can help projects that want to support using either a system install or an in-tree package of fmt.

Comment thread support/cmake/fmt-config.cmake.in Outdated
Comment on lines +3 to +5
if(NOT TARGET fmt::fmt)
include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake)
endif()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow coding conventions:

if (NOT TARGET fmt::fmt)
  include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake)
endif ()

@kieselnb
kieselnb force-pushed the cmake-allow-find-package-after-add-subdirectory branch from 31697cb to 238b946 Compare May 27, 2022 15:09
@kieselnb
kieselnb force-pushed the cmake-allow-find-package-after-add-subdirectory branch from 238b946 to afdc039 Compare May 27, 2022 15:11
@vitaut
vitaut merged commit 90b6878 into fmtlib:master May 27, 2022
@vitaut

vitaut commented May 27, 2022

Copy link
Copy Markdown
Contributor

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants