Skip to content

Commit e7d4af9

Browse files
committed
add the correct flags to the build for char8_t
1 parent 15f7f97 commit e7d4af9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

units/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,20 @@ endif()
223223

224224
if(UNITS_BUILD_CXX_MODULE)
225225
add_library(module)
226-
target_link_libraries(module PUBLIC ${UNITS_LC_PROJECT_NAME}::units)
226+
target_link_libraries(
227+
module PUBLIC ${UNITS_LC_PROJECT_NAME}::units PRIVATE compile_flags_target
228+
)
227229
target_compile_features(module PUBLIC cxx_std_20)
228230
set_target_properties(
229231
module PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD} CXX_STANDARD_REQUIRED ON
230232
)
233+
if(CMAKE_CXX_STANDARD GREATER 19)
234+
if(MSVC)
235+
target_compile_options(module PUBLIC /Zc:char8_t-)
236+
else()
237+
target_compile_options(module PUBLIC -fno-char8_t)
238+
endif()
239+
endif()
231240
target_sources(
232241
module PUBLIC FILE_SET cxx_modules TYPE CXX_MODULES FILES ${units_module_files}
233242
)

0 commit comments

Comments
 (0)