Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

kieselnb
Copy link
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 on lines 3 to 5
if(NOT TARGET fmt::fmt)
include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake)
endif()
Copy link
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
Copy link
Contributor

vitaut commented May 27, 2022

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.

None yet

2 participants