summarylogtreecommitdiffstats
path: root/0001-ArchLinux-changes-to-CMakeLists.txt.patch
blob: 98b654f2ae1fd6b5028a758637ffc2b719b06023 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From 8cea8f285e1fa3c60da7003283552b0cbbd3eb2b Mon Sep 17 00:00:00 2001
From: Joe Baldino <pedanticdm@gmx.us>
Date: Sat, 5 Feb 2022 23:36:51 +0000
Subject: [PATCH] [ArchLinux] changes to CMakeLists.txt

Changes needed to comply with ArchLinux's packaging policies and norms.
Makes for a lighter PKGBUILD.

Removed:

  * upstream-defined [C,CXX]FLAGS
  * target_link_libraries directive (unnecessary for crex)
  * superfluous message displaying build type

Added:

  * Variable containing upstream warning flags
  * Said flags added to all build types
  * CMAKE_CXX_EXTENSIONS OFF
    - Inferred from upstream's redundant -std=c++14 flag

Fixed:

  * hard-coded install path

Based on tag 0.2.5
Signed-off-by: Joe Baldino <pedanticdm@gmx.us>
---
 CMakeLists.txt | 34 ++++++++++++----------------------
 1 file changed, 12 insertions(+), 22 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb2d9ed6471b..1564f94ff376 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,25 +12,19 @@ endif(CCACHE_FOUND)
 
 set (CMAKE_CXX_STANDARD 14)
 set (CMAKE_CXX_STANDARD_REQUIRED ON)
+set (CMAKE_CXX_EXTENSIONS OFF)
 
-set (CMAKE_CXX_FLAGS "-fdiagnostics-color=auto")
-set (CMAKE_C_FLAGS "-fdiagnostics-color=auto")
+set (WARNING_FLAGS "\
+-Wpedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy \
+-Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op \
+-Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast \
+-Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion \
+-Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default \
+-Wundef -Wno-unused \
+")
 
-set (DEBUG_FLAGS "-Wpedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused -std=c++14 -g")
-set (DEBUG_LINK_FLAGS "-fprofile-arcs -ftest-coverage -flto")
-
-set (RELEASE_FLAGS "-std=c++14 -s -O3")
-set (RELEASE_LINK_FLAGS "-flto")
-
-set (CMAKE_CXX_FLAGS_DEBUG ${DEBUG_FLAGS})
-set (CMAKE_C_FLAGS_DEBUG ${DEBUG_FLAGS})
-set (CMAKE_EXE_LINKER_FLAGS_DEBUG ${DEBUG_LINK_FLAGS})
-
-set (CMAKE_CXX_FLAGS_RELEASE ${RELEASE_FLAGS})
-set (CMAKE_C_FLAGS_RELEASE ${RELEASE_FLAGS})
-set (CMAKE_EXE_LINKER_FLAGS_RELEASE ${RELEASE_LINK_FLAGS})
-
-message ("CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}")
+set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}")
 
 include_directories(
   ./src
@@ -52,8 +46,4 @@ add_executable (
   ${HEADERS}
 )
 
-target_link_libraries (
-  ${TARGET}
-)
-
-install (TARGETS ${TARGET} DESTINATION "/usr/local/bin")
+install (TARGETS ${TARGET} DESTINATION bin)
-- 
2.35.1