summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNagy-Egri Máté Ferenc <mate@streamhpc.com>2022-02-08 07:13:21 +0100
committerGitHub <noreply@github.com>2022-02-08 07:13:21 +0100
commitdcd5bede6859d26833cd85f0d6bbcee7382dc9b3 (patch)
treebf9abcd83037b63ae810564b90aed072b4d3c8fd
parent80c10b1f65b932894b830da7cd37bc56c541bae4 (diff)
downloadOpenCL-Headers-dcd5bede6859d26833cd85f0d6bbcee7382dc9b3.tar.gz
option to disable tests when subproject (#195)
-rw-r--r--CMakeLists.txt6
1 files changed, 5 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 468841c..7f66bac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,8 @@ project(OpenCLHeaders
# https://stackoverflow.com/questions/43379311/why-does-project-affect-cmakes-opinion-on-cmake-sizeof-void-p
)
+option(OPENCL_HEADERS_BUILD_TESTING "Enable support for OpenCL C headers testing." OFF)
+
include(GNUInstallDirs)
add_library(Headers INTERFACE)
@@ -83,7 +85,9 @@ install(
DESTINATION ${config_package_location}
)
-if(BUILD_TESTING)
+if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR OPENCL_HEADERS_BUILD_TESTING)
include(CTest)
+endif()
+if((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR OPENCL_HEADERS_BUILD_TESTING) AND BUILD_TESTING)
add_subdirectory(tests)
endif()