Skip to content

Commit

Permalink
add cmake install
Browse files Browse the repository at this point in the history
  • Loading branch information
miyanyan authored and microcai committed Dec 28, 2024
1 parent 007e855 commit 26f9219
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,31 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(-foptimize-sibling-calls)
endif()

include(GNUInstallDirs)

add_library(ucoro INTERFACE)
target_include_directories(ucoro INTERFACE include)
target_include_directories(ucoro INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

option(UCORO_BUILD_TESTING "Build the tests" ON)
if (UCORO_BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()

enable_testing()
add_subdirectory(tests)
install(
TARGETS ucoro
EXPORT ucoroTargets
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ucoro
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
# generate config.cmake
install(
EXPORT ucoroTargets
FILE ucoro-config.cmake
NAMESPACE ucoro::
DESTINATION "share/ucoro"
)

0 comments on commit 26f9219

Please sign in to comment.