Skip to content

Commit

Permalink
build: add ASSERT_ENABLE_INSTALL option (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
threeal authored Jun 21, 2024
1 parent 798a024 commit 492e061
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,35 @@ project(
LANGUAGES NONE
)

option(ASSERT_ENABLE_INSTALL "Enable install targets." ${PROJECT_IS_TOP_LEVEL})

include(cmake/Assertion.cmake)

if(PROJECT_IS_TOP_LEVEL)
if(BUILD_TESTING)
enable_testing()
if(PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
enable_testing()

add_test(
NAME "condition assertions"
COMMAND "${CMAKE_COMMAND}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/Assert.cmake)
add_test(
NAME "condition assertions"
COMMAND "${CMAKE_COMMAND}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/Assert.cmake)

add_test(
NAME "fatal error assertions"
COMMAND "${CMAKE_COMMAND}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/AssertFatalError.cmake)
add_test(
NAME "fatal error assertions"
COMMAND "${CMAKE_COMMAND}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/AssertFatalError.cmake)

add_test(
NAME "execute process assertions"
COMMAND "${CMAKE_COMMAND}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/AssertExecuteProcess.cmake)
add_test(
NAME "execute process assertions"
COMMAND "${CMAKE_COMMAND}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/AssertExecuteProcess.cmake)

add_test(
NAME "internal assertion message formatting"
COMMAND "${CMAKE_COMMAND}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/InternalFormatMessage.cmake)
endif()
add_test(
NAME "internal assertion message formatting"
COMMAND "${CMAKE_COMMAND}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/test/InternalFormatMessage.cmake)
endif()

if(ASSERT_ENABLE_INSTALL)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
AssertionConfigVersion.cmake
Expand Down

0 comments on commit 492e061

Please sign in to comment.