ulib/CMakeLists.txt
tqcq 61b54112eb
Some checks failed
rpcrypto-build / build (Debug, hisiv510.toolchain.cmake) (push) Successful in 42s
rpcrypto-build / build (Debug, mipsel-openwrt-linux.toolchain.cmake) (push) Failing after 51s
rpcrypto-build / build (Debug, mipsel-openwrt-linux-musl.toolchain.cmake) (push) Failing after 55s
linux-x64-gcc / linux-gcc (push) Failing after 38s
rpcrypto-build / build (Release, hisiv510.toolchain.cmake) (push) Successful in 59s
rpcrypto-build / build (Release, mipsel-openwrt-linux-musl.toolchain.cmake) (push) Failing after 1m0s
rpcrypto-build / build (Debug, himix200.toolchain.cmake) (push) Successful in 1m15s
linux-hisiv500-gcc / linux-gcc-hisiv500 (push) Failing after 1m17s
rpcrypto-build / build (Release, mipsel-openwrt-linux.toolchain.cmake) (push) Failing after 1m17s
rpcrypto-build / build (Release, himix200.toolchain.cmake) (push) Successful in 1m5s
linux-mips64-gcc / linux-gcc-mips64el (push) Failing after 2m27s
feature try disable c++11 for gtest
2023-12-11 09:26:36 +08:00

55 lines
1.5 KiB
CMake

cmake_minimum_required(VERSION 3.10)
project(ulib LANGUAGES CXX VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 98)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(ULIB_BUILD_TESTS "Build tests" OFF)
option(ULIB_SHARED_LIB "Build shared library" OFF)
if (ULIB_SHARED_LIB)
add_library(${PROJECT_NAME} SHARED "")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
else()
add_library(${PROJECT_NAME} STATIC "")
endif()
find_package(Threads REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
## CMP0063
if (POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif ()
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif ()
set(FMT_USE_CPP11 OFF CACHE BOOL "Use C++11" FORCE)
set(FMT_TEST OFF CACHE BOOL "Build tests" FORCE)
set(FMT_USE_CPP11 OFF CACHE BOOL "Use C++11" FORCE)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3party/fmt)
target_sources(${PROJECT_NAME} PRIVATE
src/ulib/empty.cpp
src/ulib/log/logger.cpp
src/ulib/log/log.cpp
src/ulib/log/level.cpp
)
target_link_libraries(${PROJECT_NAME} PUBLIC fmt::fmt)
target_compile_definitions(${PROJECT_NAME} PRIVATE ULIB_LIBRARY_IMPL)
target_include_directories(${PROJECT_NAME} PUBLIC src)
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
if(ULIB_BUILD_TESTS)
enable_testing()
set(GTEST_LANG_CXX11 OFF)
set(GTEST_HAS_TR1_TUPLE OFF)
set(GTEST_USE_OWN_TR1_TUPLE ON)
add_subdirectory(3party/googletest)
add_subdirectory(tests)
endif()