From 714181175dda33d38e6e932654a2bf3a868281f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 20 Oct 2021 08:12:15 +0000 Subject: [PATCH] CMakeList: cleanup Default CMAKE_BUILD_TYPE to Release, which implies -O3 -DNDEBUG Don't force building with -O3, which makes debugging more friendly. Remove option BUILD_DEBUG, which is covered by -DCMAKE_BUILD_TYPE=DEBUG / RelWithDebInfo --- CMakeLists.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 628034442..ec351a566 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,10 @@ cmake_minimum_required(VERSION 3.1.0) # Threads::Threads is needed project(fastfetch) option(BUILD_TESTS "Build test programs" OFF) -option(BUILD_DEBUG "Build with debug symbols" OFF) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() execute_process( COMMAND git rev-list --count HEAD @@ -27,17 +30,13 @@ execute_process ( set(PROJECT_VERSION "r${GIT_REV_LIST}.${GIT_REV_PARSE}") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -O3") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-O3") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") +set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,-O3") if(BUILD_TESTS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mtune=native -pipe -fno-plt -Wconversion -Wpedantic") endif(BUILD_TESTS) -if(BUILD_DEBUG) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") -endif(BUILD_DEBUG) - configure_file(src/fastfetch_config.h.in fastfetch_config.h) set(THREADS_PREFER_PTHREAD_FLAG ON)