Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Option to Enable Install Targets #103

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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