CMake: remove C++ option checking

There is no C++ code.
This commit is contained in:
Rolf Eike Beer 2019-06-27 08:39:02 +02:00
parent 78aa9c8623
commit 1e6d325fee
2 changed files with 3 additions and 36 deletions

View File

@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.12)
project(bzip2
VERSION 1.0.7
DESCRIPTION "This Bzip2/libbz2 a program and library for lossless block-sorting data compression.")
DESCRIPTION "This Bzip2/libbz2 a program and library for lossless block-sorting data compression."
LANGUAGES C)
# See versioning rule:
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
@ -46,7 +46,7 @@ endif()
# Do not disable assertions based on CMAKE_BUILD_TYPE.
foreach(_build_type "Release" "MinSizeRel" "RelWithDebInfo")
foreach(_lang C CXX)
foreach(_lang C)
string(TOUPPER "CMAKE_${_lang}_FLAGS_${_build_type}" _var)
string(REGEX REPLACE "(^|)[/-]D *NDEBUG($|)" " " ${_var} "${${_var}}")
endforeach()
@ -54,13 +54,6 @@ endforeach()
# Support the latest c++ standard available.
include(ExtractValidFlags)
foreach(_cxx1x_flag -std=c++14 -std=c++11)
extract_valid_cxx_flags(_cxx1x_flag_supported ${_cxx1x_flag})
if(_cxx1x_flag_supported)
set(CXX1XCXXFLAGS ${_cxx1x_flag})
break()
endif()
endforeach()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the build type" FORCE)
@ -130,16 +123,13 @@ if(NOT HAVE_DECL_INITGROUPS AND HAVE_UNISTD_H)
endif()
set(WARNCFLAGS)
set(WARNCXXFLAGS)
if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
if(ENABLE_WERROR)
set(WARNCFLAGS /WX)
set(WARNCXXFLAGS /WX)
endif()
else()
if(ENABLE_WERROR)
extract_valid_c_flags(WARNCFLAGS -Werror)
extract_valid_c_flags(WARNCXXFLAGS -Werror)
endif()
# For C compiler
@ -186,12 +176,6 @@ else()
# -Wheader-guard # Only work with Clang for the moment
-Wno-format-nonliteral # This is required because we pass format string as "const char*.
)
# For C++ compiler
extract_valid_cxx_flags(WARNCXXFLAGS
-Wall
-Wformat-security
)
endif()
if(ENABLE_DEBUG)
@ -353,12 +337,8 @@ message(STATUS "Summary of build options:
Compiler:
Build type: ${CMAKE_BUILD_TYPE}
C compiler: ${CMAKE_C_COMPILER}
C++ compiler: ${CMAKE_CXX_COMPILER}
CFLAGS: ${CMAKE_C_FLAGS_${_build_type}} ${CMAKE_C_FLAGS}
WARNCFLAGS: ${WARNCFLAGS}
CXXFLAGS: ${CMAKE_CXX_FLAGS_${_build_type}} ${CMAKE_CXX_FLAGS}
CXX1XCXXFLAGS: ${CXX1XCXXFLAGS}
WARNCXXFLAGS: ${WARNCXXFLAGS}
Test:
Python: ${Python3_FOUND} (${Python3_VERSION}, ${Python3_EXECUTABLE})
Docs:

View File

@ -16,16 +16,3 @@ function(extract_valid_c_flags varname)
endforeach()
set(${varname} "${valid_flags}" PARENT_SCOPE)
endfunction()
function(extract_valid_cxx_flags varname)
set(valid_flags)
foreach(flag IN LISTS ARGN)
string(REGEX REPLACE "[^a-zA-Z0-9_]+" "_" flag_var ${flag})
set(flag_var "CXX_FLAG_${flag_var}")
check_cxx_compiler_flag("${flag}" "${flag_var}")
if(${flag_var})
set(valid_flags "${valid_flags} ${flag}")
endif()
endforeach()
set(${varname} "${valid_flags}" PARENT_SCOPE)
endfunction()