Skip to content

Commit

Permalink
Added fconstexpr options to cmake. (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-winter authored Dec 8, 2022
1 parent d5acf81 commit 18c5669
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,20 @@ foreach (example IN LISTS examples)
add_executable(${example} ${example}.cpp)
target_link_libraries(${example} PRIVATE ctpg::ctpg)
if (CTPG_WARNING_FLAGS)
if (MSVC)
target_compile_options(
${example}
PRIVATE
/W4 /WX
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(${example} PRIVATE /W4 /WX
/wd4459 # declaration of 'identifier' hides global declaration
)
else ()
target_compile_options(${example} PRIVATE -Wall -Wextra -pedantic -Werror)
endif ()
endif ()
if (MSVC)
target_compile_options(
${example}
PRIVATE
/EHsc
/constexpr:steps100000000
)
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${example} PRIVATE -fconstexpr-steps=1000000000)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${example} PRIVATE -fconstexpr-ops-limit=1000000000)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(${example} PRIVATE /EHsc /constexpr:steps1000000000)
endif()

endforeach ()

0 comments on commit 18c5669

Please sign in to comment.