From e6918187568dbd01842d8d1d2c808ce16a894239 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 21 Apr 2024 13:54:28 +0200 Subject: Adding upstream version 18.2.2. Signed-off-by: Daniel Baumann --- src/fmt/test/static-export-test/CMakeLists.txt | 30 ++++++++++++++++++++++++++ src/fmt/test/static-export-test/library.cc | 5 +++++ src/fmt/test/static-export-test/main.cc | 6 ++++++ 3 files changed, 41 insertions(+) create mode 100644 src/fmt/test/static-export-test/CMakeLists.txt create mode 100644 src/fmt/test/static-export-test/library.cc create mode 100644 src/fmt/test/static-export-test/main.cc (limited to 'src/fmt/test/static-export-test') diff --git a/src/fmt/test/static-export-test/CMakeLists.txt b/src/fmt/test/static-export-test/CMakeLists.txt new file mode 100644 index 000000000..7690d7b5a --- /dev/null +++ b/src/fmt/test/static-export-test/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.1...3.18) + +project(fmt-link CXX) + +set(BUILD_SHARED_LIBS OFF) +set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE) +set(CMAKE_CXX_VISIBILITY_PRESET "hidden") + +# Broken LTO on GCC 4 +if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5) + set(BROKEN_LTO ON) +endif () + +if (NOT BROKEN_LTO AND CMAKE_VERSION VERSION_GREATER "3.8") + # CMake 3.9+ + include(CheckIPOSupported) + check_ipo_supported(RESULT HAVE_IPO) + if (HAVE_IPO) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + endif () +endif () + +add_subdirectory(../.. fmt) +set_property(TARGET fmt PROPERTY POSITION_INDEPENDENT_CODE ON) + +add_library(library-test SHARED library.cc) +target_link_libraries(library-test PRIVATE fmt::fmt) + +add_executable(exe-test main.cc) +target_link_libraries(exe-test PRIVATE library-test) diff --git a/src/fmt/test/static-export-test/library.cc b/src/fmt/test/static-export-test/library.cc new file mode 100644 index 000000000..fe4801ba5 --- /dev/null +++ b/src/fmt/test/static-export-test/library.cc @@ -0,0 +1,5 @@ +#include + +__attribute__((visibility("default"))) std::string foo() { + return fmt::format(FMT_COMPILE("foo bar {}"), 4242); +} diff --git a/src/fmt/test/static-export-test/main.cc b/src/fmt/test/static-export-test/main.cc new file mode 100644 index 000000000..38f7999ed --- /dev/null +++ b/src/fmt/test/static-export-test/main.cc @@ -0,0 +1,6 @@ +#include +#include + +extern std::string foo(); + +int main() { std::cout << foo() << std::endl; } -- cgit v1.2.3