Skip to content

Commit

Permalink
Merge pull request #125 from LLNL/Cxx20_flags_add_subdirectory
Browse files Browse the repository at this point in the history
C++20 required flags
  • Loading branch information
phlptp authored Feb 9, 2021
2 parents 4792b02 + e14d8e7 commit dbc0609
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(compiler_flags)
endif()

# deal with breaking changes in C++20 with u8 strings
if(CMAKE_CXX_STANDARD GREATER 19 OR UNITS_CXX_STANDARD GREATER 19)
if(MSVC)
target_compile_options(compile_flags_target INTERFACE /Zc:char8_t-)
else(MSVC)
target_compile_options(compile_flags_target INTERFACE -fno-char8_t)
endif()
endif()

if(NOT UNITS_HEADER_ONLY)
if(BUILD_SHARED_LIBS)
option(UNITS_BUILD_STATIC_LIBRARY
Expand Down
6 changes: 0 additions & 6 deletions config/compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ endif()
# Extra definitions for visual studio
# -------------------------------------------------------------
if(MSVC)
if(CMAKE_CXX_STANDARD GREATER 19 OR UNITS_CXX_STANDARD GREATER 19)
target_compile_options(compile_flags_target INTERFACE /Zc:char8_t-)
endif()
target_compile_options(
compile_flags_target INTERFACE -D_CRT_SECURE_NO_WARNINGS
-D_SCL_SECURE_NO_WARNINGS
Expand All @@ -130,9 +127,6 @@ if(MSVC)
endif(${PROJECT_NAME}_ENABLE_EXTRA_COMPILER_WARNINGS)
target_compile_options(compile_flags_target INTERFACE -D_WIN32_WINNT=0x0601)
else(MSVC)
if(CMAKE_CXX_STANDARD GREATER 19 OR UNITS_CXX_STANDARD GREATER 19)
target_compile_options(compile_flags_target INTERFACE -fno-char8_t)
endif()
option(USE_LIBCXX "Use Libc++ vs as opposed to the default" OFF)
mark_as_advanced(USE_LIBCXX)
# this is a global option on all parts
Expand Down

0 comments on commit dbc0609

Please sign in to comment.