objectcomputing / mFAST

A FAST (FIX Adapted for STreaming) encoder/decoder
http://objectcomputing.github.io/mFAST
BSD 3-Clause "New" or "Revised" License
224 stars 112 forks source link

Allow use of latest c++ standards. #122

Closed VladimirTeza closed 1 year ago

VladimirTeza commented 1 year ago

the file cmake/SetCXXStandard.cmake forces compilation to either c++11 or c++14. However project compiles with c++17 and c++20. Would it be possible to add support of ^^?

VladimirTeza commented 1 year ago

One of the possible solutions, do not set standard if it is already set:

diff --git a/cmake/SetCXXStandard.cmake b/cmake/SetCXXStandard.cmake index a0402ee..847171b 100644 --- a/cmake/SetCXXStandard.cmake +++ b/cmake/SetCXXStandard.cmake @@ -1,10 +1,12 @@

find_package(Boost 1.59.0 REQUIRED) +if(NOT DEFINED ${CMAKE_CXX_STANDARD}) if(Boost_VERSION VERSION_LESS "1.72.0") set(CMAKE_CXX_STANDARD 11 CACHE INTERNAL "specifies the C++ standard whose features are requested to build this target") else() set(CMAKE_CXX_STANDARD 14 CACHE INTERNAL "specifies the C++ standard whose features are requested to build this target") endif() +endif()

set(CMAKE_CXX_STANDARD_REQUIRED ON) if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")