Skip to content

Commit 685a9a9

Browse files
authored
Merge pull request #110 from fdefelici/105-cmake-convert-build-flags-to-option
#105 converted input variables to option
2 parents 7d3040d + 0e463b3 commit 685a9a9

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

.github/workflows/ci_action.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
echo "== CMAKE VERSION =="
3131
cmake --version
3232
echo "== CMAKE CONFIGURE =="
33-
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_BUILD=true
33+
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_BUILD=ON
3434
echo "== CMAKE BUILD =="
3535
cmake --build ${{env.BUILD_DIR}} --config Release
3636
- name: List Build
@@ -61,7 +61,7 @@ jobs:
6161
echo "== CMAKE VERSION =="
6262
cmake --version
6363
echo "== CMAKE CONFIGURE =="
64-
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_BUILD=true
64+
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_BUILD=ON
6565
echo "== CMAKE BUILD =="
6666
cmake --build ${{env.BUILD_DIR}} --config Release
6767
- name: List Build
@@ -78,14 +78,14 @@ jobs:
7878
fail-fast: false
7979
matrix:
8080
compiler:
81-
- {c: gcc, cpp: g++, v: 11, strict: false}
82-
- {c: gcc, cpp: g++, v: 12, strict: false}
83-
- {c: gcc, cpp: g++, v: 13, strict: true}
84-
- {c: clang, cpp: clang++, v: 13, strict: true}
85-
- {c: clang, cpp: clang++, v: 14, strict: true}
86-
- {c: clang, cpp: clang++, v: 15, strict: true}
87-
- {c: clang, cpp: clang++, v: 16, strict: true}
88-
- {c: clang, cpp: clang++, v: 17, strict: true}
81+
- {c: gcc, cpp: g++, v: 11, strict: OFF}
82+
- {c: gcc, cpp: g++, v: 12, strict: OFF}
83+
- {c: gcc, cpp: g++, v: 13, strict: ON}
84+
- {c: clang, cpp: clang++, v: 13, strict: ON}
85+
- {c: clang, cpp: clang++, v: 14, strict: ON}
86+
- {c: clang, cpp: clang++, v: 15, strict: ON}
87+
- {c: clang, cpp: clang++, v: 16, strict: ON}
88+
- {c: clang, cpp: clang++, v: 17, strict: ON}
8989
defaults:
9090
run:
9191
shell: bash
@@ -125,7 +125,7 @@ jobs:
125125
echo "== CMAKE VERSION =="
126126
cmake --version
127127
echo "== CMAKE CONFIGURE =="
128-
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_BUILD=true -DCLOVE_CMAKE__CPP_STRICT_WARN_AS_ERROR=${{matrix.compiler.strict}}
128+
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_BUILD=ON -DCLOVE_CMAKE__CPP_STRICT_WARN_AS_ERROR=${{matrix.compiler.strict}}
129129
echo "== CMAKE BUILD =="
130130
cmake --build ${{env.BUILD_DIR}} --config Release
131131
- name: List Build
@@ -153,7 +153,7 @@ jobs:
153153
echo "== CMAKE VERSION =="
154154
cmake --version
155155
echo "== CMAKE CONFIGURE =="
156-
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_SANITY=true
156+
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_SANITY=ON
157157
echo "== CMAKE BUILD =="
158158
cmake --build ${{env.BUILD_DIR}} --config Release
159159
- name: List Build

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ include(JoinPaths)
2222
include(GNUInstallDirs)
2323
include(CMakePackageConfigHelpers)
2424

25+
# Eventually CMAKE_INSTALL_PREFIX can be overridden by the user to change base installation path for the package
2526
join_paths(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" clove-unit ${PROJECT_VERSION})
2627

2728
# Library Target definition and configuration
@@ -84,6 +85,11 @@ export(PACKAGE clove-unit)
8485
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
8586
include(CTest)
8687

88+
option(CLOVE_CMAKE__UC_BUILD "enable build use case" OFF)
89+
option(CLOVE_CMAKE__UC_SANITY "enable sanity check use case" OFF)
90+
option(CLOVE_CMAKE__UC_PERFS "enable performance test use case" OFF)
91+
option(CLOVE_CMAKE__CPP_STRICT_WARN_AS_ERROR "threat compilation warning as error" OFF)
92+
8793
if (CLOVE_CMAKE__UC_BUILD)
8894
add_subdirectory(tests/functs)
8995
add_subdirectory(tests/stricts/clove-c)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Here a few examples:
112112

113113
First download `CLove-Unit` repository and then run cmake install command on it.
114114

115-
Package will be installed in at following path: `<CMAKE_INSTALL_PREFIX/clove-unit/<CLOVE_VERSION>`
115+
Package will be installed in at following path: `<CMAKE_INSTALL_PREFIX>/clove-unit/<CLOVE_VERSION>`
116116

117117
Eventually you may want to customize [CMAKE_INSTALL_PREFIX](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html) variable to override cmake default installation path for packages.
118118

tests/stricts/clove-cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ target_include_directories(StrictCloveCpp PRIVATE ../../../)
77

88
set_property(TARGET StrictCloveCpp PROPERTY CXX_STANDARD 11)
99

10-
if (NOT DEFINED CLOVE_CMAKE__CPP_STRICT_WARN_AS_ERROR OR CLOVE_CMAKE__CPP_STRICT_WARN_AS_ERROR EQUAL TRUE)
10+
if (CLOVE_CMAKE__CPP_STRICT_WARN_AS_ERROR)
1111
set_property(TARGET StrictCloveCpp PROPERTY COMPILE_WARNING_AS_ERROR ON)
1212
endif()
1313

0 commit comments

Comments
 (0)