feature add CMAKE_POSITION_INDEPENDENT_CODE
Some checks failed
rpcrypto-build / build (Release, host-afl.toolchain.cmake) (push) Waiting to run
rpcrypto-build / build (Release, mipsel-openwrt-linux-musl.toolchain.cmake) (push) Waiting to run
rpcrypto-build / build (Release, mipsel-openwrt-linux.toolchain.cmake) (push) Waiting to run
rpcrypto-build / build (Debug, himix200.toolchain.cmake) (push) Successful in 1m8s
rpcrypto-build / build (Debug, hisiv500.toolchain.cmake) (push) Successful in 1m13s
rpcrypto-build / build (Debug, hisiv510.toolchain.cmake) (push) Successful in 1m12s
rpcrypto-build / build (Debug, mipsel-openwrt-linux-musl.toolchain.cmake) (push) Successful in 1m24s
rpcrypto-build / build (Debug, mipsel-openwrt-linux.toolchain.cmake) (push) Has been cancelled
rpcrypto-build / build (Debug, host-afl.toolchain.cmake) (push) Has been cancelled
rpcrypto-build / build (Release, himix200.toolchain.cmake) (push) Has been cancelled
rpcrypto-build / build (Release, hisiv500.toolchain.cmake) (push) Has been cancelled
rpcrypto-build / build (Release, hisiv510.toolchain.cmake) (push) Has been cancelled
linux-mips64-gcc / linux-gcc-mips64el (push) Failing after 3m2s

This commit is contained in:
tqcq 2023-12-05 16:42:18 +08:00
parent 844f343335
commit e6cc0c9e81

View File

@ -5,6 +5,16 @@ set(CMAKE_CXX_STANDARD 98)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) 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) find_package(Threads REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@ -15,19 +25,12 @@ endif ()
if (POLICY CMP0048) if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW) cmake_policy(SET CMP0048 NEW)
endif () endif ()
set(FMT_USE_CPP11 OFF CACHE BOOL "Use C++11" FORCE) set(FMT_USE_CPP11 OFF CACHE BOOL "Use C++11" FORCE)
set(FMT_TEST OFF CACHE BOOL "Build tests" FORCE) set(FMT_TEST OFF CACHE BOOL "Build tests" FORCE)
set(FMT_USE_CPP11 OFF CACHE BOOL "Use C++11" FORCE) set(FMT_USE_CPP11 OFF CACHE BOOL "Use C++11" FORCE)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3party/fmt) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3party/fmt)
option(ULIB_BUILD_TESTS "Build tests" OFF)
option(ULIB_SHARED_LIB "Build shared library" OFF)
if (ULIB_SHARED_LIB)
add_library(${PROJECT_NAME} SHARED "")
else()
add_library(${PROJECT_NAME} STATIC "")
endif()
target_sources(${PROJECT_NAME} PRIVATE target_sources(${PROJECT_NAME} PRIVATE
src/ulib/empty.cpp src/ulib/empty.cpp