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

[CMake][feat] Support FetchContent use #519

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@ project(yaLanTingLibs
# load pack finder
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Find/)

# add include path
include_directories(include)
include_directories(include/ylt/thirdparty)
include_directories(src/include)

find_package(Threads REQUIRED)
link_libraries(Threads::Threads)

include(cmake/utils.cmake)
include(cmake/struct_pb.cmake)
include(cmake/build.cmake)
include(cmake/develop.cmake)
include(cmake/install.cmake)
# add project config, such as enable_ssl.
include(cmake/config.cmake)
# add project's source such as unit test, example & benchmark
include(cmake/subdir.cmake)

if(CMAKE_PROJECT_NAME STREQUAL "yaLanTingLibs") # if ylt is top-level project
# add include path
include_directories(include)
include_directories(include/ylt/thirdparty)
include_directories(src/include)

include(cmake/utils.cmake)
include(cmake/struct_pb.cmake)
include(cmake/build.cmake)
include(cmake/develop.cmake)
# add project config, such as enable_ssl.
include(cmake/config.cmake)
# add project's source such as unit test, example & benchmark
include(cmake/subdir.cmake)
endif()

8 changes: 7 additions & 1 deletion cmake/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ write_basic_package_version_file(
)
set(ConfigPackageLocation lib/cmake/yalantinglibs)


add_library(yalantinglibs INTERFACE)
add_library(yalantinglibs::yalantinglibs ALIAS yalantinglibs)

target_include_directories(yalantinglibs INTERFACE
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/../include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/../include/ylt/thirdparty>
)
install(TARGETS yalantinglibs
EXPORT yalantinglibsTargets
LIBRARY DESTINATION lib
Expand Down
Loading