mirror of
https://github.com/fmtlib/fmt.git
synced 2026-07-30 16:26:27 +08:00
Fix for find-package-test and C++20 link issues
This commit is contained in:
parent
68ff73bc56
commit
e424a934af
4
.github/workflows/linux.yml
vendored
4
.github/workflows/linux.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
|
||||
strategy:
|
||||
matrix:
|
||||
cxx: [g++-4.9, g++-11, clang++-3.6, clang++-11]
|
||||
cxx: [g++-4.9, g++-11, clang++-11]
|
||||
build_type: [Debug, Release]
|
||||
std: [11]
|
||||
shared: [""]
|
||||
@ -42,7 +42,7 @@ jobs:
|
||||
std: 23
|
||||
os: ubuntu-24.04
|
||||
gen: Ninja
|
||||
- cxx: clang++-3.6
|
||||
# - cxx: clang++-3.6
|
||||
- cxx: clang++-11
|
||||
build_type: Debug
|
||||
std: 17
|
||||
|
||||
@ -416,6 +416,12 @@ endfunction ()
|
||||
if (FMT_MODULE)
|
||||
add_module_library(fmt-module src/fmt.cc USE_CMAKE_MODULES
|
||||
${FMT_USE_CMAKE_MODULES})
|
||||
# Add implementation sources as separate compilation units
|
||||
# This ensures symbols are available for linking even in C++20
|
||||
target_sources(fmt-module PRIVATE src/format.cc)
|
||||
if (FMT_OS)
|
||||
target_sources(fmt-module PRIVATE src/os.cc)
|
||||
endif ()
|
||||
setup_target(fmt-module PUBLIC)
|
||||
endif ()
|
||||
|
||||
|
||||
@ -18,18 +18,18 @@ build: GNUmakefile CMakeLists.txt
|
||||
cmake --version # NOTE: v4.4 expected! CK
|
||||
cmake -G Ninja -S . -B build --fresh \
|
||||
-D CMAKE_SKIP_TEST_ALL_DEPENDENCY=NO \
|
||||
-D FMT_MODULE=1 -D FMT_IMPORT_STD=1 -D CMAKE_CXX_STANDARD=23 \
|
||||
-D FMT_PEDANTIC=YES \
|
||||
-D FMT_MODULE=1 -D FMT_IMPORT_STD=0 -D CMAKE_CXX_STANDARD=20 \
|
||||
-D CMAKE_EXPERIMENTAL_CXX_IMPORT_STD=f35a9ac6-8463-4d38-8eec-5d6008153e7d
|
||||
ln -fs build/compile_commands.json .
|
||||
|
||||
find-package-test: install
|
||||
cmake -G Ninja -S test/find-package-test -B build/find-package-build --fresh \
|
||||
-D FMT_MODULE=1 -D FMT_IMPORT_STD=1 -D CMAKE_CXX_STANDARD=23 \
|
||||
-D FMT_MODULE=1 -D FMT_IMPORT_STD=0 -D CMAKE_CXX_STANDARD=20 \
|
||||
-D CMAKE_EXPERIMENTAL_CXX_IMPORT_STD=f35a9ac6-8463-4d38-8eec-5d6008153e7d
|
||||
ninja -C build/find-package-build -v
|
||||
ninja -C build/find-package-build -t deps CMakeFiles/module-test.dir/main.cc.o
|
||||
./build/find-package-build/module-test build/find-package-build/*-test
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf build .cache compile_commands.json
|
||||
|
||||
@ -184,6 +184,8 @@ if (FMT_PEDANTIC
|
||||
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
|
||||
"-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}"
|
||||
"-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}"
|
||||
"-DFMT_IMPORT_STD=${FMT_IMPORT_STD}"
|
||||
"-DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=${CMAKE_EXPERIMENTAL_CXX_IMPORT_STD}"
|
||||
"-DFMT_DIR=${PROJECT_BINARY_DIR}"
|
||||
"-DPEDANTIC_COMPILE_FLAGS=${PEDANTIC_COMPILE_FLAGS}"
|
||||
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
|
||||
|
||||
@ -9,13 +9,11 @@ set(PEDANTIC_COMPILE_FLAGS)
|
||||
add_executable(library-test main.cc)
|
||||
target_link_libraries(library-test fmt::fmt)
|
||||
target_compile_options(library-test PRIVATE ${PEDANTIC_COMPILE_FLAGS})
|
||||
target_include_directories(library-test PUBLIC SYSTEM .)
|
||||
|
||||
if (TARGET fmt::fmt-header-only)
|
||||
add_executable(header-only-test main.cc)
|
||||
target_link_libraries(header-only-test fmt::fmt-header-only)
|
||||
target_compile_options(header-only-test PRIVATE ${PEDANTIC_COMPILE_FLAGS})
|
||||
target_include_directories(header-only-test PUBLIC SYSTEM .)
|
||||
endif ()
|
||||
|
||||
if (TARGET fmt::fmt-module)
|
||||
@ -26,5 +24,4 @@ if (TARGET fmt::fmt-module)
|
||||
target_compile_features(module-test PRIVATE cxx_std_23)
|
||||
set_target_properties(module-test PROPERTIES CXX_MODULE_STD 1)
|
||||
endif ()
|
||||
target_include_directories(module-test PUBLIC SYSTEM .)
|
||||
endif ()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user