使用cmake find_package来规范化引入依赖
parent
86f198ffe8
commit
c0d32c6ea7
|
@ -17,6 +17,13 @@ target_link_libraries(generallib public
|
||||||
libevent.a
|
libevent.a
|
||||||
-Wl,--no-whole-archive
|
-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})
|
message("current path is" ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
IF (WIN32)
|
IF (WIN32)
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
|
@ -29,7 +36,6 @@ IF (WIN32)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/libd/libevent.a
|
${CMAKE_CURRENT_SOURCE_DIR}/libd/libevent.a
|
||||||
COMMENT "package library ar -x ${CMAKE_CURRENT_SOURCE_DIR}/libd/libevent.a "
|
COMMENT "package library ar -x ${CMAKE_CURRENT_SOURCE_DIR}/libd/libevent.a "
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command (
|
add_custom_command (
|
||||||
TARGET generallib POST_BUILD
|
TARGET generallib POST_BUILD
|
||||||
COMMAND ar rc libgeneral.a *.obj
|
COMMAND ar rc libgeneral.a *.obj
|
||||||
|
|
Loading…
Reference in New Issue