Skip to content

Commit

Permalink
Try to refactory the CMakeLists.txt files
Browse files Browse the repository at this point in the history
  • Loading branch information
ClausKlein committed Jan 2, 2025
1 parent 48c0954 commit b8eac3a
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 128 deletions.
185 changes: 88 additions & 97 deletions .TODO.txt
Original file line number Diff line number Diff line change
@@ -1,120 +1,111 @@
Executing workflow step 1 of 5: configure preset "dev"

Preset CMake variables:

CMAKE_BUILD_TYPE="Debug"
CMAKE_CXX_EXTENSIONS="OFF"
CMAKE_CXX_FLAGS="-fstack-protector-strong -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wno-implicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast"
CMAKE_CXX_STANDARD="20"
CMAKE_CXX_STANDARD_REQUIRED="ON"
CMAKE_EXPORT_COMPILE_COMMANDS="ON"
CMAKE_BUILD_TYPE="Release"
CMAKE_CXX_EXTENSIONS:BOOL="TRUE"
CMAKE_CXX_FLAGS_DEBUG="-fstack-protector-strong -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wundef -Wno-float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wno-implicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast"
CMAKE_CXX_STANDARD="23"
CMAKE_CXX_STANDARD_REQUIRED:BOOL="TRUE"
CMAKE_INSTALL_PREFIX:PATH="/Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir"
CMAKE_PREFIX_PATH:STRING="/Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir"
FMT_DEVELOPER_MODE="ON"
FMT_DEVELOPER_MODE:BOOL="TRUE"

-- use ccache
-- The CXX compiler identification is Clang 19.1.4
-- The CXX compiler identification is Clang 19.1.6
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ - skipped
-- Check for working CXX compiler: /usr/local/Cellar/llvm/19.1.6/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
'brew' '--prefix' 'llvm@19'
-- LLVM_PREFIX=/usr/local/opt/llvm
-- LLVM_ROOT=/usr/local/Cellar/llvm/19.1.6
-- LLVM_LIBC_SOURCE=/usr/local/opt/llvm/share/libc++/v1
-- CMAKE_CXX_COMPILER_IMPORT_STD=
-- CPPdefinitions=FMT_USE_FCNTL=0;FMT_MODULE;HAS_STDLIB_MODULES
-- Found Git: /usr/local/bin/git (found version "2.47.1")
-- CPM: Adding package [email protected] (11.0.2 at /Users/clausklein/.cache/CPM/fmt/cccb77ae9609d2768ed80dd42cec54f77b1f1455)
-- The C compiler identification is Clang 19.1.4
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- CPM: Adding package [email protected] (v1.15.2 at /Users/clausklein/.cache/CPM/googletest/63d366a111d035db343a038884a22e44986dcf4d)
-- Module tests to be built:
-- Configuring done (1.9s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/build/dev
-- CPM: Adding package [email protected] (11.1.1 at /Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5)
CMake Warning at tests/CMakeLists.txt:50 (message):
ADD_STDLIB_MODULES=stdlib

Executing workflow step 2 of 5: build preset "dev"

[1/4] Generating CXX dyndep file tests/CMakeFiles/header-only-test.dir/CXX.dd
[1/2] Install the project...
-- Install configuration: "Debug"
-- Installing: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/stagedir/lib/cmake/fmt/fmtTargets.cmake
-- Module tests to be built: header-only-test
-- Configuring done (1.0s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/build

Executing workflow step 3 of 5: build preset "verify"
[1/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-DFMT_MODULE -DFMT_USE_FCNTL=0 -DHAS_STDLIB_MODULES
-I/Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5/include -O3 -DNDEBUG -std=gnu++23
-fexperimental-library -stdlib=libc++ -x c++ /Users/clausklein/Workspace/cpp/cxx20/fmt-module/module/fmt.cppm -c -o
CMakeFiles/fmt.dir/module/fmt.cppm.o -resource-dir "/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi -MD -MF CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi.d >
CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi.tmp && mv CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi.tmp
CMakeFiles/fmt.dir/module/fmt.cppm.o.ddi

[1/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/base.h.cxx.o
[2/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/args.h.cxx.o
[3/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/chrono.h.cxx.o
[4/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/format.h.cxx.o
[5/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/compile.h.cxx.o
[6/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/os.h.cxx.o
[7/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/color.h.cxx.o
[8/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/format-inl.h.cxx.o
[9/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/ostream.h.cxx.o
[10/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/core.h.cxx.o
[11/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/printf.h.cxx.o
[12/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/ranges.h.cxx.o
[13/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/std.h.cxx.o
[14/14] Building CXX object CMakeFiles/fmt-header-only_verify_interface_header_sets.dir/fmt-header-only_verify_interface_header_sets/fmt/xchar.h.cxx.o
[2/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-D_LIBCPP_HAS_NO_LOCALIZATION -O3 -DNDEBUG -std=gnu++23 -fexperimental-library -stdlib=libc++
-Wno-reserved-module-identifier -x c++ /usr/local/opt/llvm/share/libc++/v1/std.cppm -c -o
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.cppm.o -resource-dir
"/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.cppm.o.ddi -MD -MF
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.cppm.o.ddi.d >
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.cppm.o.ddi.tmp && mv
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.cppm.o.ddi.tmp
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.cppm.o.ddi

Executing workflow step 4 of 5: test preset "dev"
[3/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-D_LIBCPP_HAS_NO_LOCALIZATION -O3 -DNDEBUG -std=gnu++23 -fexperimental-library -stdlib=libc++
-Wno-reserved-module-identifier -x c++ /usr/local/opt/llvm/share/libc++/v1/std.compat.cppm -c -o
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.compat.cppm.o -resource-dir
"/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.compat.cppm.o.ddi -MD -MF
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.compat.cppm.o.ddi.d >
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.compat.cppm.o.ddi.tmp && mv
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.compat.cppm.o.ddi.tmp
tests/CMakeFiles/stdlib.dir/usr/local/opt/llvm/share/libc++/v1/std.compat.cppm.o.ddi

Test project /Users/clausklein/Workspace/cpp/cxx20/fmt-module/build/dev
Start 1: find-package-test
Start 2: header-only-test
1/2 Test #2: header-only-test ................. Passed 0.01 sec
2/2 Test #1: find-package-test ................ Passed 3.02 sec
[4/18] /usr/local/bin/cmake -E cmake_ninja_dyndep --tdi=CMakeFiles/fmt.dir/CXXDependInfo.json --lang=CXX --modmapfmt=clang
--dd=CMakeFiles/fmt.dir/CXX.dd @CMakeFiles/fmt.dir/CXX.dd.rsp

100% tests passed, 0 tests failed out of 2
[5/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-DFMT_MODULE -DFMT_USE_FCNTL=0 -DHAS_STDLIB_MODULES -D_LIBCPP_HAS_NO_LOCALIZATION
-I/Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5/include -O3 -DNDEBUG -std=gnu++23
-fexperimental-library -stdlib=libc++ -x c++ /Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc -c
-o tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o -resource-dir "/usr/local/Cellar/llvm/19.1.6/lib/clang/19"
-MT tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi -MD -MF
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi.d >
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi.tmp && mv
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi.tmp
tests/CMakeFiles/header-only-test.dir/header-only-test.cc.o.ddi

Total Test time (real) = 3.02 sec
[6/18] /usr/local/bin/cmake -E cmake_ninja_dyndep --tdi=tests/CMakeFiles/stdlib.dir/CXXDependInfo.json --lang=CXX
--modmapfmt=clang --dd=tests/CMakeFiles/stdlib.dir/CXX.dd @tests/CMakeFiles/stdlib.dir/CXX.dd.rsp

Executing workflow step 5 of 5: package preset "dev"
[7/18] "/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-D_LIBCPP_HAS_NO_LOCALIZATION -O3 -DNDEBUG -std=gnu++23 -fexperimental-library -stdlib=libc++ -x c++
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc -c -o
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o -resource-dir
"/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi -MD -MF
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.d >
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.tmp && mv
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.tmp
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi

CPack: Create package using TGZ
CPack: Install projects
CPack: - Install project: fmt []
CPack: Create package
CPack: - package: /Users/clausklein/Workspace/cpp/cxx20/fmt-module/build/dev/fmt-11.0.2-Darwin.tar.gz generated.
Enabled checks:
misc-header-include-cycle
misc-include-cleaner
FAILED: module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi

Running clang-tidy for 1 files out of 19 in compilation database ...
[1/1][2.1s] /usr/local/opt/llvm/bin/clang-tidy -checks=-*,misc-header-*,misc-include-* -p=build/dev /Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc
/Users/clausklein/.cache/CPM/fmt/cccb77ae9609d2768ed80dd42cec54f77b1f1455/include/fmt/format.h:41:10: warning: circular header file dependency detected while including 'base.h', please check the include path [misc-header-include-cycle]
41 | #include "base.h"
| ^
/Users/clausklein/.cache/CPM/fmt/cccb77ae9609d2768ed80dd42cec54f77b1f1455/include/fmt/base.h:3075:12: note: 'format.h' included from here
3075 | # include "format.h"
| ^
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc:3:10: note: 'base.h' included from here
3 | #include "fmt/base.h"
| ^
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc:4:1: warning: included header ostream.h is not used directly [misc-include-cleaner]
4 | #include "fmt/ostream.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~
5 | #include "gtest/gtest.h"
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc:13:18: warning: no header providing "fmt::format" is directly included [misc-include-cleaner]
4 | #include "fmt/ostream.h"
5 | #include "gtest/gtest.h"
6 |
7 | #ifndef FMT_HEADER_ONLY
8 | # error "Not in the header-only mode."
9 | #endif
10 |
11 | TEST(header_only_test, format)
12 | {
13 | EXPECT_EQ(fmt::format("foo"), "foo");
| ^
4 warnings generated.
Suppressed 1 warnings (1 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
"/usr/local/Cellar/llvm/19.1.6/bin/clang-scan-deps" -format=p1689 -- /usr/local/Cellar/llvm/19.1.6/bin/clang++
-D_LIBCPP_HAS_NO_LOCALIZATION -O3 -DNDEBUG -std=gnu++23 -fexperimental-library -stdlib=libc++ -x c++
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc -c -o
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o -resource-dir
"/usr/local/Cellar/llvm/19.1.6/lib/clang/19" -MT
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi -MD -MF
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.d >
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.tmp && mv
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi.tmp
module/tests/CMakeFiles/module_header-only-test.dir/__/__/tests/header-only-test.cc.o.ddi

ninja: Entering directory `build/dev'
[1/1] Checking spelling
Used config files:
1: .codespellrc
Error while scanning dependencies for /Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc:
/Users/clausklein/Workspace/cpp/cxx20/fmt-module/tests/header-only-test.cc:16:12: fatal error: 'fmt/base.h' file not found
ninja: build stopped: subcommand failed.
make: *** [test] Error 1
45 changes: 23 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ include(cmake/prelude.cmake)

# Set experimental flag to enable `import std` support from CMake.
# This must be enabled before C++ language support.
# TODO: set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD 0e5b6991-d74f-4b3d-a41c-cf096e0b2508)
if(CMAKE_CXX_SCAN_FOR_MODULES)
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD 0e5b6991-d74f-4b3d-a41c-cf096e0b2508)
endif()

project(fmt
VERSION 11.1.1.1
Expand All @@ -18,17 +20,18 @@ include(cmake/variables.cmake)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_SCAN_FOR_MODULES ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_DEBUG_POSTFIX D)
# to prevent -Winclude-angled-in-module-purview in fmt/os.h
# see /Users/clausklein/.cache/CPM/fmt/297020319ba1d5d14e1599714def59a1788711c5/include/fmt/os.h:33
set(CPPdefinitions FMT_USE_FCNTL=0)
set(ADD_STDLIB_MODULES)

option(FMT_SEPARATE_COMPILATION "build fmt lib too" ${PROJECT_IS_TOP_LEVEL})
option(FMT_USE_MODULES "Export a CXX_MODULE fmt if possible" ${PROJECT_IS_TOP_LEVEL})
option(FMT_IMPORT_STD "Import the module std" ${PROJECT_IS_TOP_LEVEL})
option(FMT_SEPARATE_COMPILATION "build fmt lib too" ${CMAKE_CXX_SCAN_FOR_MODULES})
option(FMT_USE_MODULES "Export a CXX_MODULE fmt if possible" ${CMAKE_CXX_SCAN_FOR_MODULES})
option(FMT_IMPORT_STD "Import the module std" ${FMT_USE_MODULES})

if(FMT_USE_MODULES)
list(APPEND CPPdefinitions FMT_MODULE)
Expand All @@ -55,17 +58,17 @@ if(FMT_USE_MODULES)
add_compile_options(-stdlib=libc++)
add_link_options(-stdlib=libc++)
endif()
endif()

# Tell CMake that we explicitly want `import std`.
# This will initialize the property on all targets declared after this to 1
if(CMAKE_CXX_COMPILER_IMPORT_STD)
set(CMAKE_CXX_MODULE_STD ON)
endif()
# Tell CMake that we explicitly want `import std`.
# This will initialize the property on all targets declared after this to 1
if(CMAKE_CXX_COMPILER_IMPORT_STD)
set(CMAKE_CXX_MODULE_STD ON)
endif()

if(CMAKE_CXX_MODULE_STD AND ADD_STDLIB_MODULES)
# FIXME: NO! list(APPEND CPPdefinitions FMT_IMPORT_STD)
list(APPEND CPPdefinitions HAS_STDLIB_MODULES)
endif()
if(CMAKE_CXX_MODULE_STD OR ADD_STDLIB_MODULES)
# FIXME: NO! list(APPEND CPPdefinitions FMT_IMPORT_STD)
list(APPEND CPPdefinitions HAS_STDLIB_MODULES)
endif()

message(STATUS "CMAKE_CXX_COMPILER_IMPORT_STD=${CMAKE_CXX_COMPILER_IMPORT_STD}")
Expand All @@ -75,7 +78,7 @@ else()
set(CMAKE_VERIFY_INTERFACE_HEADER_SETS ${PROJECT_IS_TOP_LEVEL})
endif()

if(ADD_STDLIB_MODULES AND CMAKE_BUILD_TYPE STREQUAL Release)
if(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD AND CMAKE_BUILD_TYPE STREQUAL Release)
include(cmake/example.cmake)
endif()

Expand All @@ -89,7 +92,7 @@ cpmaddpackage(
GITHUB_REPOSITORY fmtlib/fmt
GIT_TAG 11.1.1
VERSION 11.1.1
DOWNLOAD_ONLY YES
DOWNLOAD_ONLY ON
)
# cmake-format: on

Expand Down Expand Up @@ -130,15 +133,14 @@ if(FMT_SEPARATE_COMPILATION)
fmt PUBLIC FILE_SET public_headers TYPE HEADERS BASE_DIRS ${fmt_SOURCE_DIR}/include FILES ${_fmt_public_header}
)

target_compile_definitions(fmt PUBLIC ${CPPdefinitions})
target_compile_options(fmt PUBLIC $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:MSVC>>:/utf-8>)
target_compile_features(
fmt INTERFACE "$<$<COMPILE_FEATURES:cxx_std_23>:cxx_std_23>" "$<$<NOT:$<COMPILE_FEATURES:cxx_std_23>>:cxx_std_20>"
)

target_compile_options(fmt PUBLIC $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:MSVC>>:/utf-8>)

if(FMT_USE_MODULES)
add_library(fmt::fmt-module ALIAS fmt)
target_compile_definitions(fmt PUBLIC ${CPPdefinitions})
add_library(fmt::fmt_module ALIAS fmt)
# cmake-format: off
target_sources(fmt PUBLIC
FILE_SET public_modules
Expand All @@ -152,8 +154,7 @@ if(FMT_SEPARATE_COMPILATION)
else()
add_library(fmt::fmt ALIAS fmt)
set_target_properties(fmt PROPERTIES CXX_SCAN_FOR_MODULES OFF)
target_compile_definitions(fmt PUBLIC ${CPPdefinitions})
target_sources(fmt PUBLIC ${_fmt_all_sources})
target_sources(fmt PRIVATE ${_fmt_all_sources})
endif()

if(FMT_WARNINGS_AS_ERRORS AND FMT_DEVELOPER_MODE AND UNIX)
Expand Down
4 changes: 2 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ check: all

test:
cmake --preset ci-${hostSystemName}
cmake --build build
cmake --build build -- -v -j 1
cmake --install build --prefix $(CURDIR)/stagedir
cmake -G Ninja -B build/tests -S tests -D CMAKE_PREFIX_PATH=$(CURDIR)/stagedir
cmake --build build/tests
cmake --build build/tests -- -v -j 1
ctest --test-dir build/tests

example:
Expand Down
2 changes: 1 addition & 1 deletion cmake/install-rules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ if(FMT_USE_MODULES)
install(TARGETS fmt EXPORT fmtTargets FILE_SET public_headers #
FILE_SET public_modules DESTINATION ${FMT_INSTALL_CMAKEDIR}/module
)
install(FILES module/fmt.cppm DESTINATION ${FMT_INSTALL_CMAKEDIR}/module)
else()
install(TARGETS fmt EXPORT fmtTargets FILE_SET public_headers)
endif()
install(FILES module/fmt.cppm DESTINATION ${FMT_INSTALL_CMAKEDIR}/module)
install(FILES ${_fmt_all_sources} DESTINATION ${FMT_INSTALL_CMAKEDIR}/module)

write_basic_package_version_file("${_package}ConfigVersion.cmake" COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)
Expand Down
Loading

0 comments on commit b8eac3a

Please sign in to comment.