Skip to content

Commit 65b5409

Browse files
authored
Merge pull request #24 from JonasVautherin/export-target
export as target
2 parents 49df1ea + daebcb3 commit 65b5409

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

CMakeLists.txt

+5-20
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,9 @@ if(CMAKE_CXX_STANDARD LESS 11)
2020
endif()
2121

2222
add_library(ghc_filesystem INTERFACE)
23-
target_sources(ghc_filesystem INTERFACE
24-
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/filesystem.hpp
25-
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_fwd.hpp
26-
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_impl.hpp
27-
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_std.hpp
28-
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_std_fwd.hpp
29-
${CMAKE_CURRENT_SOURCE_DIR}/include/ghc/fs_std_impl.hpp
30-
)
31-
target_include_directories(ghc_filesystem INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
23+
target_include_directories(ghc_filesystem INTERFACE
24+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
25+
$<INSTALL_INTERFACE:include>)
3226
target_compile_options(ghc_filesystem INTERFACE "$<$<C_COMPILER_ID:MSVC>:/utf-8>")
3327
target_compile_options(ghc_filesystem INTERFACE "$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
3428

@@ -52,14 +46,5 @@ include(CMakePackageConfigHelpers)
5246
include(GNUInstallDirs)
5347

5448
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
55-
56-
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR})
57-
set(PACKAGECONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
58-
59-
configure_package_config_file(cmake/config.cmake.in
60-
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
61-
INSTALL_DESTINATION ${PACKAGECONFIG_INSTALL_DIR}
62-
PATH_VARS INCLUDE_INSTALL_DIR)
63-
64-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
65-
DESTINATION ${PACKAGECONFIG_INSTALL_DIR})
49+
install(TARGETS ghc_filesystem EXPORT ghcFilesystemConfig)
50+
install(EXPORT ghcFilesystemConfig NAMESPACE ghcFilesystem:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ghcFilesystem)

0 commit comments

Comments
 (0)