为避免误操作,更新名称为libMESA_handle_logger2,ABI向前兼容,install后创建软连接至libMESA_handle_logger.so
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
|
||||
set(lib_name MESA_handle_logger)
|
||||
set(lib_name MESA_handle_logger2)
|
||||
|
||||
project (${lib_name})
|
||||
|
||||
@@ -32,17 +32,11 @@ endif()
|
||||
# end of for ASAN
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/inc/)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/zlog/)
|
||||
|
||||
add_subdirectory(zlog)
|
||||
|
||||
file(GLOB SRC
|
||||
"src/*.c"
|
||||
"src/*.cpp"
|
||||
)
|
||||
|
||||
# Shared Library Output
|
||||
add_library(${lib_name}_shared SHARED ${SRC})
|
||||
add_library(${lib_name}_shared SHARED src/MESA_handle_logger.c)
|
||||
target_link_libraries(${lib_name}_shared zlog-static)
|
||||
set_target_properties(${lib_name}_shared PROPERTIES LINK_FLAGS
|
||||
"-Wl,--version-script=${PROJECT_SOURCE_DIR}/src/version.map")
|
||||
@@ -57,7 +51,7 @@ set_target_properties(${lib_name}_shared PROPERTIES VERSION ${LIB_MAJOR_VERSION}
|
||||
set_target_properties(${lib_name}_shared PROPERTIES SOVERSION ${LIB_MAJOR_VERSION})
|
||||
|
||||
# static Library Output
|
||||
add_library(${lib_name}_static STATIC ${SRC})
|
||||
add_library(${lib_name}_static STATIC src/MESA_handle_logger.c)
|
||||
target_link_libraries(${lib_name}_static -Wl,--whole-archive zlog-static -Wl,--no-whole-archive)
|
||||
set_target_properties(${lib_name}_static PROPERTIES OUTPUT_NAME ${lib_name})
|
||||
|
||||
@@ -65,17 +59,19 @@ set(CMAKE_INSTALL_PREFIX /opt/MESA)
|
||||
|
||||
install(TARGETS ${lib_name}_shared LIBRARY DESTINATION
|
||||
${CMAKE_INSTALL_PREFIX}/lib)
|
||||
install(FILES inc/${lib_name}.h DESTINATION
|
||||
|
||||
install(CODE "execute_process( \
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink \
|
||||
libMESA_handle_logger2.so \
|
||||
${CMAKE_INSTALL_PREFIX}/lib/libMESA_handle_logger.so \
|
||||
)"
|
||||
)
|
||||
|
||||
install(FILES inc/MESA_handle_logger.h DESTINATION
|
||||
${CMAKE_INSTALL_PREFIX}/include/MESA COMPONENT devel)
|
||||
|
||||
|
||||
|
||||
file(GLOB DEMO
|
||||
"demo/*.c"
|
||||
"demo/*.cpp"
|
||||
)
|
||||
|
||||
add_executable(${lib_name}_demo ${DEMO})
|
||||
add_executable(${lib_name}_demo demo/test_handle_logger.c)
|
||||
target_link_libraries(${lib_name}_demo rt pthread ${lib_name}_static)
|
||||
|
||||
include(Package)
|
||||
|
||||
Reference in New Issue
Block a user