Skip to content

Commit

Permalink
Merge pull request #110 from fdefelici/105-cmake-convert-build-flags-…
Browse files Browse the repository at this point in the history
…to-option

#105 converted input variables to option
  • Loading branch information
fdefelici authored Jun 20, 2024
2 parents 7d3040d + 0e463b3 commit 685a9a9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
echo "== CMAKE VERSION =="
cmake --version
echo "== CMAKE CONFIGURE =="
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_BUILD=true
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_BUILD=ON
echo "== CMAKE BUILD =="
cmake --build ${{env.BUILD_DIR}} --config Release
- name: List Build
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
echo "== CMAKE VERSION =="
cmake --version
echo "== CMAKE CONFIGURE =="
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_BUILD=true
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_BUILD=ON
echo "== CMAKE BUILD =="
cmake --build ${{env.BUILD_DIR}} --config Release
- name: List Build
Expand All @@ -78,14 +78,14 @@ jobs:
fail-fast: false
matrix:
compiler:
- {c: gcc, cpp: g++, v: 11, strict: false}
- {c: gcc, cpp: g++, v: 12, strict: false}
- {c: gcc, cpp: g++, v: 13, strict: true}
- {c: clang, cpp: clang++, v: 13, strict: true}
- {c: clang, cpp: clang++, v: 14, strict: true}
- {c: clang, cpp: clang++, v: 15, strict: true}
- {c: clang, cpp: clang++, v: 16, strict: true}
- {c: clang, cpp: clang++, v: 17, strict: true}
- {c: gcc, cpp: g++, v: 11, strict: OFF}
- {c: gcc, cpp: g++, v: 12, strict: OFF}
- {c: gcc, cpp: g++, v: 13, strict: ON}
- {c: clang, cpp: clang++, v: 13, strict: ON}
- {c: clang, cpp: clang++, v: 14, strict: ON}
- {c: clang, cpp: clang++, v: 15, strict: ON}
- {c: clang, cpp: clang++, v: 16, strict: ON}
- {c: clang, cpp: clang++, v: 17, strict: ON}
defaults:
run:
shell: bash
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
echo "== CMAKE VERSION =="
cmake --version
echo "== CMAKE CONFIGURE =="
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_BUILD=true -DCLOVE_CMAKE__CPP_STRICT_WARN_AS_ERROR=${{matrix.compiler.strict}}
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_BUILD=ON -DCLOVE_CMAKE__CPP_STRICT_WARN_AS_ERROR=${{matrix.compiler.strict}}
echo "== CMAKE BUILD =="
cmake --build ${{env.BUILD_DIR}} --config Release
- name: List Build
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
echo "== CMAKE VERSION =="
cmake --version
echo "== CMAKE CONFIGURE =="
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_SANITY=true
cmake -B${{env.BUILD_DIR}} -DCLOVE_CMAKE__UC_SANITY=ON
echo "== CMAKE BUILD =="
cmake --build ${{env.BUILD_DIR}} --config Release
- name: List Build
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ include(JoinPaths)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

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

# Library Target definition and configuration
Expand Down Expand Up @@ -84,6 +85,11 @@ export(PACKAGE clove-unit)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
include(CTest)

option(CLOVE_CMAKE__UC_BUILD "enable build use case" OFF)
option(CLOVE_CMAKE__UC_SANITY "enable sanity check use case" OFF)
option(CLOVE_CMAKE__UC_PERFS "enable performance test use case" OFF)
option(CLOVE_CMAKE__CPP_STRICT_WARN_AS_ERROR "threat compilation warning as error" OFF)

if (CLOVE_CMAKE__UC_BUILD)
add_subdirectory(tests/functs)
add_subdirectory(tests/stricts/clove-c)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Here a few examples:

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

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

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.

Expand Down
2 changes: 1 addition & 1 deletion tests/stricts/clove-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ target_include_directories(StrictCloveCpp PRIVATE ../../../)

set_property(TARGET StrictCloveCpp PROPERTY CXX_STANDARD 11)

if (NOT DEFINED CLOVE_CMAKE__CPP_STRICT_WARN_AS_ERROR OR CLOVE_CMAKE__CPP_STRICT_WARN_AS_ERROR EQUAL TRUE)
if (CLOVE_CMAKE__CPP_STRICT_WARN_AS_ERROR)
set_property(TARGET StrictCloveCpp PROPERTY COMPILE_WARNING_AS_ERROR ON)
endif()

Expand Down

0 comments on commit 685a9a9

Please sign in to comment.