diff options
Diffstat (limited to 'host/CMakeLists.txt')
-rw-r--r-- | host/CMakeLists.txt | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 377302857..a66d6bd16 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -80,9 +80,25 @@ ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") ENDIF() ENDIF() +IF(CMAKE_VERSION VERSION_LESS "3.1") + IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + SET(CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}") + ELSEIF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + IF("${IS_APPLE}" STREQUAL "") + SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") + ELSE() + SET(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ ${CMAKE_CXX_FLAGS}") + ENDIF() + ENDIF() +ELSE() + SET(CMAKE_CXX_STANDARD 11) +ENDIF() + IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") SET(CMAKE_EXE_LINKER_FLAGS "-lthr ${CMAKE_EXE_LINKER_FLAGS}") + SET(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}") ENDIF() + ######################################################################## # Packaging Variables ######################################################################## @@ -177,7 +193,7 @@ INCLUDE(CheckCXXCompilerFlag) MACRO(UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG flag have) CHECK_CXX_COMPILER_FLAG(${flag} ${have}) IF(${have}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}") ENDIF(${have}) ENDMACRO(UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG) @@ -195,7 +211,7 @@ IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") IF(STRIP_BINARIES) IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s") ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") ENDIF(STRIP_BINARIES) ADD_DEFINITIONS(-Wall) @@ -209,6 +225,12 @@ IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN) UHD_ADD_OPTIONAL_CXX_COMPILER_FLAG(-fvisibility-inlines-hidden HAVE_VISIBILITY_INLINES_HIDDEN) ENDIF(NOT WIN32) + IF(${CMAKE_BUILD_TYPE} STREQUAL "Coverage") + include(CodeCoverage) + setup_target_for_coverage(coverage "ctest || return 0" coverage) # never fail ctest, always generate coverage report + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -pthread -g -O0 -fprofile-arcs -ftest-coverage" CACHE STRING "Flags used by the C++ compiler during Coverage builds." FORCE) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -pthread -g -O0 -fprofile-arcs -ftest-coverage" CACHE STRING "Flags used by the C compiler during Coverage builds." FORCE) + ENDIF() ENDIF() IF(MSVC) @@ -289,6 +311,7 @@ MESSAGE(STATUS "Boost libraries: ${Boost_LIBRARIES}") # Note: RFNoC never gets fully disabled, but the public APIs do SET(ENABLE_RFNOC OFF CACHE BOOL "Export RFNoC includes and symbols") INCLUDE(UHDGlobalDefs) +INCLUDE(UHDLog) ######################################################################## # Check Python Modules |