Skip to content

Commit

Permalink
Enable Conan compiler.cppstd to override nmos-cpp's preferred CMAKE_C…
Browse files Browse the repository at this point in the history
…XX_STANDARD (#207)

Using idiomatic existence checks on all the CMAKE_CXX_ variables and treating CMAKE_CXX_STANDARD as a normal variable rather than cache variable
  • Loading branch information
garethsb committed Dec 6, 2021
1 parent 20e1000 commit 575d8f9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Development/cmake/NmosCppCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@ endif()

# enable C++11
enable_language(CXX)
set(CMAKE_CXX_STANDARD 11 CACHE STRING "Default value for CXX_STANDARD property of targets")
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
endif()
if(CMAKE_CXX_STANDARD STREQUAL "98")
message(FATAL_ERROR "CMAKE_CXX_STANDARD must be 11 or higher; C++98 is not supported")
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
if(NOT DEFINED CMAKE_CXX_EXTENSIONS)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

if(NMOS_CPP_BUILD_TESTS AND CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
# note: to see the output of any failed tests, set CTEST_OUTPUT_ON_FAILURE=1 in the environment
Expand Down

0 comments on commit 575d8f9

Please sign in to comment.