Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Add __cplusplus macro for MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
anand-bala committed Jan 13, 2021
1 parent b7bbd68 commit 2af65d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ set(LCOV_REMOVE_PATTERNS
"${CMAKE_CURRENT_LISTS_DIR}/examples/*"
)

set(CMAKE_CXX_STANDARD
17
CACHE STRING "C++ version selection"
)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)

Expand Down
6 changes: 5 additions & 1 deletion cmake/StandardProjectSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ endif()
option(ENABLE_LTO "Enable link time optimization?" OFF)

include(CheckIPOSupported)
check_ipo_supported(RESULT result OUTPUT output)
check_ipo_supported(RESULT RESULT OUTPUT OUTPUT)
if(result)
set(ENABLE_LTO
ON
Expand All @@ -40,6 +40,10 @@ function(set_default_compile_options target)
endif()
endif()

if(MSVC)
target_compile_options(${target} PRIVATE /Zc:__cplusplus)
endif()

endfunction()

function(set_std_filesystem_options target)
Expand Down

0 comments on commit 2af65d4

Please sign in to comment.