Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required (VERSION 2.8.11)
cmake_minimum_required (VERSION 3.1)
project (mraa C CXX)

# Use the CMake 3.1 means to set the CXX standard
set (CMAKE_CXX_STANDARD 11)

FIND_PACKAGE (Threads REQUIRED)

if (CMAKE_VERSION VERSION_LESS "3.1")
Expand Down Expand Up @@ -74,17 +77,6 @@ foreach (flag ${MRAA_BOTH_WARNING_FLAGS} ${MRAA_CXX_WARNING_FLAGS})
endif ()
endforeach ()

# This function adds the c++11 flag to a c++ target (if supported)
function(use_cxx_11 targetname)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if (COMPILER_SUPPORTS_CXX11)
set_target_properties(${targetname} PROPERTIES COMPILE_FLAGS "-std=c++11")
else()
message(FATAL_ERROR "Target '${targetname}' requires c++11 which is not supported by this compiler")
endif()
endfunction()

# Set CMAKE_INSTALL_LIBDIR if not defined
include(GNUInstallDirs)

Expand Down
3 changes: 0 additions & 3 deletions tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ if (DETECTED_ARCH STREQUAL "MOCK")
target_include_directories(test_unit_ioinit_hpp PRIVATE "${CMAKE_SOURCE_DIR}/api")
gtest_add_tests(test_unit_ioinit_hpp "" api/mraa_initio_hpp_unit.cxx)
list(APPEND GTEST_UNIT_TEST_TARGETS test_unit_ioinit_hpp)

# The initio C++ header requires c++11
use_cxx_11(test_unit_ioinit_hpp)
endif()

# Add a target for all unit tests
Expand Down