[cmake] Define alias ghcFilesystem::ghc_filesystem unconditionally

This alias is needed whether or not the install rules of `ghcfilesystem`
are enabled. It allows projects to use the same target regardless of
where `ghcfilesystem` comes from, `add_subdirectory` or `find_package`.
This commit is contained in:
Luc Touraille 2023-01-11 09:08:06 +01:00
parent 3e5b930d96
commit 6c6f2c2ec0

View File

@ -37,6 +37,7 @@ message(STATUS "Compiler ID: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "CMAKE_CXX_COMPILE_FEATURES: ${CMAKE_CXX_COMPILE_FEATURES}")
add_library(ghc_filesystem INTERFACE)
add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem)
target_include_directories(ghc_filesystem INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
@ -72,5 +73,4 @@ if(GHC_FILESYSTEM_WITH_INSTALL)
PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
install(FILES "${PROJECT_BINARY_DIR}/cmake/ghc_filesystem-config.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ghc_filesystem")
add_library(ghcFilesystem::ghc_filesystem ALIAS ghc_filesystem)
endif()