Skip to content

Commit 67633c9

Browse files
authored
cmake: option to disable testing by setting BUILD_TESTING to OFF (#629)
1 parent 47685b0 commit 67633c9

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ list(GET VERSION_LIST 1 PROJECT_VERSION_MINOR)
1212
list(GET VERSION_LIST 2 PROJECT_VERSION_PATCH)
1313
unset(VERSION_LIST)
1414

15-
enable_testing()
15+
include(CTest)
1616

1717
# Follow GNU conventions for installation directories
1818
include(GNUInstallDirs)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Important options are
133133
The minimum required rank to compile this project is 4.
134134
Compiling with maximum rank 15 can be resource intensive and requires at least 16 GB of memory to allow parallel compilation or 4 GB memory for sequential compilation.
135135
- `-DBUILD_SHARED_LIBS` set to `on` in case you want link your application dynamically against the standard library (default: `off`).
136+
- `-DBUILD_TESTING` set to `off` in case you want to disable the stdlib tests (default: `on`).
136137

137138
For example, to configure a build using the Ninja backend while specifying compiler flags `FFLAGS`, generating procedures up to rank 7, and installing to your home directory, use
138139

src/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ else()
114114
target_sources(${PROJECT_NAME} PRIVATE f08estop.f90)
115115
endif()
116116

117-
add_subdirectory(tests)
117+
if(BUILD_TESTING)
118+
enable_testing()
119+
add_subdirectory(tests)
120+
endif()
118121

119122
install(TARGETS ${PROJECT_NAME}
120123
EXPORT ${PROJECT_NAME}-targets

0 commit comments

Comments
 (0)