Merge pull request #24 from JonasVautherin/export-target

export as target
This commit is contained in:
gulrak 2019-09-29 19:20:06 +02:00 committed by GitHub
commit 65b54093ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,15 +20,9 @@ if(CMAKE_CXX_STANDARD LESS 11)
endif()
add_library(ghc_filesystem INTERFACE)
target_sources(ghc_filesystem INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/filesystem.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_fwd.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_impl.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_std.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_std_fwd.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_std_impl.hpp
)
target_include_directories(ghc_filesystem INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(ghc_filesystem INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_options(ghc_filesystem INTERFACE "$<$<C_COMPILER_ID:MSVC>:/utf-8>")
target_compile_options(ghc_filesystem INTERFACE "$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
@ -52,14 +46,5 @@ include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
set(PACKAGECONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
configure_package_config_file(cmake/config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION ${PACKAGECONFIG_INSTALL_DIR}
PATH_VARS INCLUDE_INSTALL_DIR)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
DESTINATION ${PACKAGECONFIG_INSTALL_DIR})
install(TARGETS ghc_filesystem EXPORT ghcFilesystemConfig)
install(EXPORT ghcFilesystemConfig NAMESPACE ghcFilesystem:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ghcFilesystem)