mirror of https://github.com/AxioDL/amuse.git
Exclude CMake CXX standard from MSVC
This commit is contained in:
parent
9c75aeccbe
commit
92f44407c6
|
@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
||||||
|
|
||||||
project(amuse)
|
project(amuse)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
if (NOT MSVC)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
add_compile_options(-Wno-narrowing)
|
add_compile_options(-Wno-narrowing)
|
||||||
|
@ -98,20 +100,27 @@ endif()
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_compile_options(amuse PRIVATE
|
target_compile_options(amuse PRIVATE
|
||||||
# Enforce various standards compliant behavior.
|
# Enforce various standards compliant behavior.
|
||||||
/permissive-
|
$<$<COMPILE_LANGUAGE:CXX>:/permissive->
|
||||||
|
|
||||||
# Enable standard volatile semantics.
|
# Enable standard volatile semantics.
|
||||||
/volatile:iso
|
$<$<COMPILE_LANGUAGE:CXX>:/volatile:iso>
|
||||||
|
|
||||||
# Reports the proper value for the __cplusplus preprocessor macro.
|
# Reports the proper value for the __cplusplus preprocessor macro.
|
||||||
/Zc:__cplusplus
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>
|
||||||
|
|
||||||
|
# Use latest C++ standard.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>
|
||||||
|
)
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
|
# Flags for MSVC (not clang-cl)
|
||||||
|
target_compile_options(amuse PRIVATE
|
||||||
# Allow constexpr variables to have explicit external linkage.
|
# Allow constexpr variables to have explicit external linkage.
|
||||||
/Zc:externConstexpr
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:externConstexpr>
|
||||||
|
|
||||||
# Assume that new throws exceptions, allowing better code generation.
|
# Assume that new throws exceptions, allowing better code generation.
|
||||||
/Zc:throwingNew
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:throwingNew>
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
target_compile_options(amuse PRIVATE -Wno-unknown-pragmas)
|
target_compile_options(amuse PRIVATE -Wno-unknown-pragmas)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -84,20 +84,27 @@ target_compile_definitions(amuse-gui PRIVATE
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_compile_options(amuse-gui PRIVATE
|
target_compile_options(amuse-gui PRIVATE
|
||||||
# Enforce various standards compliant behavior.
|
# Enforce various standards compliant behavior.
|
||||||
/permissive-
|
$<$<COMPILE_LANGUAGE:CXX>:/permissive->
|
||||||
|
|
||||||
# Enable standard volatile semantics.
|
# Enable standard volatile semantics.
|
||||||
/volatile:iso
|
$<$<COMPILE_LANGUAGE:CXX>:/volatile:iso>
|
||||||
|
|
||||||
# Reports the proper value for the __cplusplus preprocessor macro.
|
# Reports the proper value for the __cplusplus preprocessor macro.
|
||||||
/Zc:__cplusplus
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>
|
||||||
|
|
||||||
|
# Use latest C++ standard.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>
|
||||||
|
)
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
|
# Flags for MSVC (not clang-cl)
|
||||||
|
target_compile_options(amuse-gui PRIVATE
|
||||||
# Allow constexpr variables to have explicit external linkage.
|
# Allow constexpr variables to have explicit external linkage.
|
||||||
/Zc:externConstexpr
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:externConstexpr>
|
||||||
|
|
||||||
# Assume that new throws exceptions, allowing better code generation.
|
# Assume that new throws exceptions, allowing better code generation.
|
||||||
/Zc:throwingNew
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:throwingNew>
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|
Loading…
Reference in New Issue