cmake更新,指定代码编译,保证向前兼容取消soversion设置

This commit is contained in:
yangwei
2020-09-07 16:26:27 +08:00
parent 7827bb0408
commit 8825da8881
2 changed files with 11 additions and 19 deletions

View File

@@ -10,7 +10,6 @@ set(LIB_MINOR_VERSION 1)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(Version)
#SET(CMAKE_C_COMPILER "/usr/bin/g++")
set(CMAKE_MACOSX_RPATH 0)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wall)
set(CMAKE_INSTALL_PREFIX /opt/MESA)
@@ -35,26 +34,21 @@ endif()
include_directories(${PROJECT_SOURCE_DIR}/inc/)
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)
if(DEFINED MESA_SHARED_INSTALL_DIR)
set_target_properties(${lib_name}_shared PROPERTIES OUTPUT_NAME ${lib_name} LIBRARY_OUTPUT_DIRECTORY ${MESA_SHARED_INSTALL_DIR})
else()
set_target_properties(${lib_name}_shared PROPERTIES OUTPUT_NAME ${lib_name})
endif()
set_target_properties(${lib_name}_shared PROPERTIES VERSION ${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION})
set_target_properties(${lib_name}_shared PROPERTIES SOVERSION ${LIB_MAJOR_VERSION})
#set_target_properties(${lib_name}_shared PROPERTIES VERSION ${LIB_MAJOR_VERSION}.${LIB_MINOR_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)
set_target_properties(${lib_name}_static PROPERTIES OUTPUT_NAME ${lib_name})
set(CMAKE_INSTALL_PREFIX /opt/MESA)
@@ -64,12 +58,7 @@ install(FILES inc/${lib_name}.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ME
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)

9
README
View File

@@ -4,13 +4,16 @@
*Author:yangwei@iie.ac.cn
*History:
2014-03-24 created by yw
1)first version
1)第一个动态库版本
2014-04-16 modified by yw
1)strict inspection parameters, compatible with g++ 4.4.4
1) 支持g++ 4.4.4编译
2014-05-29 update by yw
1)create directory is supported
1)支持创建用户指定的日志目录
2019-2-18 update by yw
1)性能优化句柄中存储文件fp定期flush至文件
-------------------------------------------------------------------------------------
NOTICE:
1)compatible with g++, extern with c;