Skip to content

Commit 3c6344c

Browse files
committed
fix: dev: cleanup compiler flags in cmake and tox, add verbose option
* remove duplicate std flags in favor of standard cmake settings * remove static flags tox env, set default GNU compiler names * add verbose make output when set via VERBOSE environment var Signed-off-by: Stephen L Arnold <sarnold@vctlabs.com>
1 parent 6179dbd commit 3c6344c

File tree

3 files changed

+11
-19
lines changed

3 files changed

+11
-19
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
1515
OPTION(LIBTINS_BUILD_EXAMPLES "Build examples" ON)
1616
OPTION(LIBTINS_BUILD_TESTS "Build tests" ON)
1717

18+
1819
# Compile in release mode by default
1920
IF(NOT CMAKE_BUILD_TYPE)
2021
MESSAGE(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
@@ -28,6 +29,10 @@ project(
2829
LANGUAGES CXX
2930
)
3031

32+
if(DEFINED ENV{VERBOSE})
33+
set(CMAKE_VERBOSE_MAKEFILE ON)
34+
endif()
35+
3136
# Check the thread library info early as setting compiler flags seems to
3237
# interfere with the detection and causes CMAKE_THREAD_LIBS_INIT to not
3338
# include -lpthread when it should.
@@ -76,9 +81,10 @@ SET(TINS_VERSION_MINOR 6)
7681
SET(TINS_VERSION_PATCH 0)
7782
SET(LIBTINS_VERSION "${TINS_VERSION_MAJOR}.${TINS_VERSION_MINOR}")
7883

79-
set(CMAKE_CXX_STANDARD 14)
84+
set(CMAKE_CXX_STANDARD 11)
8085
set(CMAKE_CXX_STANDARD_REQUIRED ON)
81-
set(CMAKE_CXX_EXTENSIONS ON)
86+
set(CMAKE_CXX_EXTENSIONS OFF)
87+
MESSAGE(STATUS "Using C++ STD version '${CMAKE_CXX_STANDARD}'")
8288

8389
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
8490
set(CLANG_DEFAULT_CXX_STDLIB libc++)

cmake/Modules/CheckCXXFeatures.cmake

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,6 @@ endif ()
5252

5353
#cmake_minimum_required(VERSION 2.8.3)
5454

55-
#
56-
### Check for needed compiler flags
57-
#
58-
include(CheckCXXCompilerFlag)
59-
check_cxx_compiler_flag("-std=c++11" _HAS_CXX11_FLAG)
60-
if (NOT _HAS_CXX11_FLAG)
61-
check_cxx_compiler_flag("-std=c++0x" _HAS_CXX0X_FLAG)
62-
endif ()
63-
64-
if (_HAS_CXX11_FLAG)
65-
set(CXX11_COMPILER_FLAGS "-std=c++11")
66-
elseif (_HAS_CXX0X_FLAG)
67-
set(CXX11_COMPILER_FLAGS "-std=c++0x")
68-
endif ()
6955

7056
function(cxx11_check_feature FEATURE_NAME RESULT_VAR)
7157
if (NOT DEFINED ${RESULT_VAR})

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ install_command = pip install {opts} {packages}
1010

1111
[testenv:tools]
1212
setenv =
13-
CFLAGS = -march=native -O2 -g -DNDEBUG
14-
CXXFLAGS = {env:CFLAGS:-march=native -O2 -g -DNDEBUG}
15-
LDFLAGS = {env:CFLAGS:-march=native -O2 -g -DNDEBUG} -Wl,-O1 -Wl,--as-needed
13+
CC = {env:CC:gcc}
14+
CXX = {env:CXX:g++}
1615
PREFIX = {env:PREFIX:{envdir}}
1716

1817
passenv =
@@ -28,6 +27,7 @@ passenv =
2827
HOME
2928
USERNAME
3029
USER
30+
VERBOSE
3131
CI
3232
XDG_*
3333
GITHUB*

0 commit comments

Comments
 (0)