1
0
mirror of https://github.com/google/cpu_features.git synced 2025-04-27 15:12:30 +02:00

cmake: make default test building dependent on being a main project build vs. being included into other projects (#290)

This commit is contained in:
damageboy 2023-05-04 09:54:03 +03:00 committed by GitHub
parent 936b9ab551
commit 41e206e435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,6 +10,14 @@ project(CpuFeatures VERSION 0.8.0 LANGUAGES C)
set(CMAKE_C_STANDARD 99)
# when cpu_features is included as subproject (i.e. using add_subdirectory(cpu_features))
# in the source tree of a project that uses it, test rules are disabled.
if(NOT CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
option(BUILD_TESTING "Enable test rule" OFF)
else()
option(BUILD_TESTING "Enable test rule" ON)
endif()
# Default Build Type to be Release
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING