Skip to content

Commit

Permalink
refactor: follow CMake Starter version 2.0.0 style and configuration (#…
Browse files Browse the repository at this point in the history
…242)

* ci: rename steps in workflows

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>

* build: install package version file under `cmake` dir

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>

* build: create package version file with `ARCH_INDEPENDENT` option

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>

* style: format CMake files

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>

* docs: remove module description in `Assertion.cmake` file

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>

---------

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
  • Loading branch information
threeal authored Oct 6, 2024
1 parent f4ade02 commit d16f3c9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Build Project
runs-on: ubuntu-22.04
steps:
- name: Checkout
- name: Checkout Project
uses: actions/checkout@v4.2.0

- name: Configure Project
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Install Project
run: cmake --install build --prefix install

- name: Upload Project as Artifact
- name: Upload Project
uses: actions/upload-artifact@v4.4.0
with:
name: Assertion
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Test Project
runs-on: ubuntu-22.04
steps:
- name: Checkout
- name: Checkout Project
uses: actions/checkout@v4.2.0

- name: Configure Project
Expand Down
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ project(
LANGUAGES NONE)

option(ASSERTION_ENABLE_TESTS "Enable test targets.")
option(ASSERTION_ENABLE_INSTALL "Enable install targets."
${PROJECT_IS_TOP_LEVEL})
option(ASSERTION_ENABLE_INSTALL "Enable install targets." "${PROJECT_IS_TOP_LEVEL}")

include(cmake/Assertion.cmake)

Expand All @@ -25,12 +24,12 @@ endif()

if(ASSERTION_ENABLE_INSTALL)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
AssertionConfigVersion.cmake COMPATIBILITY SameMajorVersion)
write_basic_package_version_file(cmake/AssertionConfigVersion.cmake
COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)

install(
FILES cmake/Assertion.cmake
cmake/AssertionConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/AssertionConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/AssertionConfigVersion.cmake
DESTINATION lib/cmake/Assertion)
endif()
12 changes: 0 additions & 12 deletions cmake/Assertion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# This module contains a collection of assertion functions and other utilities
# for testing CMake code.
#
# The main feature of this module is the `assert` function for asserting the
# given condition in the style of CMake's `if` function. If the assertion fails,
# it will throw a fatal error message with information about the context of the
# asserted condition.
#
# This module also supports CMake test creation using the
# `add_cmake_script_test` function. This function will create a new test that
# processes the given file in script mode.

# This variable contains the version of the included `Assertion.cmake` module.
set(ASSERTION_VERSION 2.0.0)

Expand Down

0 comments on commit d16f3c9

Please sign in to comment.