3
0
mirror of https://github.com/triqs/dft_tools synced 2024-06-03 03:45:32 +02:00

[cmake] Globally disable compiler extensions, minor improvements in CMakeLists.txt

This commit is contained in:
Nils Wentzell 2021-02-01 15:02:57 -05:00
parent 73aa51608e
commit 16bf47b9cc

View File

@ -58,13 +58,12 @@ if(NOT IS_SUBPROJECT)
endif()
set(${PROJECT_NAME}_BINARY_DIR ${PROJECT_BINARY_DIR} CACHE STRING "Binary directory of the ${PROJECT_NAME} Project")
# ############
# Options
# Make additional Find Modules available
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/share/cmake/Modules)
# ############
# CMake Options
# Default to Release build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Type of build" FORCE)
@ -88,12 +87,22 @@ if(Build_Tests)
enable_testing()
endif()
# Build static libraries by default
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
# ############
# Global Compilation Settings
# Export the list of compile-commands into compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Global compiler options
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
# Disable compiler extensions
set(CMAKE_CXX_EXTENSIONS OFF)
# Provide additional debugging information for Debug builds
add_compile_options($<$<CONFIG:Debug>:-ggdb3>)
# Enable Linktime optimizations when available
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported)
@ -118,16 +127,11 @@ target_compile_options(${PROJECT_NAME}_warnings
$<$<CXX_COMPILER_ID:GNU>:-Wno-comma-subscript>
$<$<CXX_COMPILER_ID:GNU>:-Wshadow=local>
$<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>
$<$<CXX_COMPILER_ID:Clang>:-Wno-deprecated-comma-subscript>
$<$<CXX_COMPILER_ID:Clang>:-Wno-unknown-warning-option>
$<$<CXX_COMPILER_ID:Clang>:-Wshadow>
$<$<CXX_COMPILER_ID:Clang>:-Wno-gcc-compat>
$<$<CXX_COMPILER_ID:Clang>:-Wno-c++20-extensions>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-deprecated-comma-subscript>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-unknown-warning-option>
$<$<CXX_COMPILER_ID:AppleClang>:-Wshadow>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-gcc-compat>
$<$<CXX_COMPILER_ID:AppleClang>:-Wno-c++20-extensions>
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-deprecated-comma-subscript>
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-unknown-warning-option>
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wshadow>
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-gcc-compat>
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-c++20-extensions>
)
# #############