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:
parent
936b9ab551
commit
41e206e435
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user