使用cmake find_package来规范化引入依赖

master
caiyuzheng 2020-11-15 01:10:47 +08:00
parent 86f198ffe8
commit c0d32c6ea7
1 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,13 @@ target_link_libraries(generallib public
libevent.a
-Wl,--no-whole-archive
)
find_package(libevent REQUIRED)
set(EVENT__HAVE_LIBEVENT 1)
message(STATUS "libevent include: ${libevent_INCLUDE_DIR}")
message(STATUS "libevent lib: ${libevent_LIBRARIES}")
message(STATUS "libevent lib Dirs: ${libevent_LIB_DIRS}")
message("current path is" ${CMAKE_CURRENT_SOURCE_DIR})
IF (WIN32)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
@ -29,7 +36,6 @@ IF (WIN32)
${CMAKE_CURRENT_SOURCE_DIR}/libd/libevent.a
COMMENT "package library ar -x ${CMAKE_CURRENT_SOURCE_DIR}/libd/libevent.a "
)
add_custom_command (
TARGET generallib POST_BUILD
COMMAND ar rc libgeneral.a *.obj