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

Hide enable_testing() under PROJECT_IS_TOP_LEVEL condition. #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(fastor VERSION 0.6.4)

option(BUILD_TESTING "Build the testing tree." ON)
if(PROJECT_IS_TOP_LEVEL)
option(FASTOR_BUILD_TESTING "Build the testing tree." ON)
endif()

set(FASTOR_SOURCE_DIR "${fastor_SOURCE_DIR}")
set(FASTOR_BINARY_DIR "${fastor_BINARY_DIR}")
Expand All @@ -21,9 +23,8 @@ target_include_directories(
$<BUILD_INTERFACE:${FASTOR_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${FASTOR_INSTALL_INCLUDE_DIR}>)

if(BUILD_TESTING)
if(FASTOR_BUILD_TESTING)
enable_testing()

add_subdirectory(tests)
endif()

Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_finite_difference/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.21)
project(benchmark_finite_difference)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmark_material/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.21)
project(benchmark_material)

set(CMAKE_CXX_STANDARD 14)
Expand Down
4 changes: 1 addition & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_fastor)

set(FASTOR_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../)

set(CMAKE_CXX_STANDARD 14)

enable_testing()

if(MSVC)
add_compile_options("/std:c++17" "/W2" "$<$<CONFIG:RELEASE>:/O2>")
else()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_auxiliary_funcs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_auxiliary_funcs)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_binary_cmp_ops/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_binary_cmp_ops)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_booleans/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_booleans)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_complex_expressions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_complex_expressions)

set(CMAKE_CXX_STANDARD 14)
Expand Down
4 changes: 1 addition & 3 deletions tests/test_einsum/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_einsum)

set(CMAKE_CXX_STANDARD 14)

enable_testing()

# single einsum
# MSVC gives superfluous errors
if(NOT MSVC)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_einsum_explicit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_einsum)

set(CMAKE_CXX_STANDARD 17)

enable_testing()

# explicit einsum
# single expressions
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fixed_views_1d/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_fixed_views_1d)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fixed_views_2d/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_fixed_views_2d)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fixed_views_nd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_fixed_views_nd)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_inverse/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_inverse)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_linalg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_linalg)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_lu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_lu)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_math_functions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_math_functions)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_matmul/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_matmul)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mixed_views/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_mixed_views)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_numerics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_numerics)

set(CMAKE_CXX_STANDARD 14)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_permute/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_permute)

set(CMAKE_CXX_STANDARD 14)

enable_testing()

# default recursive CXX14
add_executable(test_permute_1 test_permute.cpp)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_qr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_qr)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_random_views/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_random_views)

set(CMAKE_CXX_STANDARD 14)
Expand Down
7 changes: 2 additions & 5 deletions tests/test_simd_vectors/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_simd_vectors)

set(CMAKE_CXX_STANDARD 14)

enable_testing()


add_executable(test_simd_vectors test_simd_vectors.cpp)
add_test(test_simd_vectors test_simd_vectors)

Expand All @@ -30,4 +27,4 @@ else()
endif()

target_include_directories(test_simd_vectors_complex PRIVATE ${FASTOR_INCLUDE_DIR})
target_include_directories(test_simd_vectors_complex PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../)
target_include_directories(test_simd_vectors_complex PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../)
2 changes: 1 addition & 1 deletion tests/test_solve/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_solve)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tensor_basics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_tensor_basics)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tensormap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_tensormap)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tmatmul/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_tmatmul)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_transpose/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_transpose)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_unary_bool_ops/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_unary_bool_ops)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_views_1d/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_views_1d)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_views_2d/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_views_2d)

set(CMAKE_CXX_STANDARD 14)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_views_nd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.21)
project(test_views_nd)

set(CMAKE_CXX_STANDARD 14)
Expand Down