cmake: Cleanup BUILD_TESTS code
authorJuan Ramos <juan@lunarg.com>
Fri, 27 Jan 2023 22:42:49 +0000 (15:42 -0700)
committerJuan Ramos <114601453+juan-lunarg@users.noreply.github.com>
Sat, 28 Jan 2023 00:19:54 +0000 (17:19 -0700)
CMakeLists.txt

index 4747328733c6c6b4cdce15c1a737e665033a35b0..e972081c14355d7560478e445157c54c7109fb8a 100644 (file)
@@ -29,12 +29,6 @@ find_package(PythonInterp 3 QUIET)
 set(THREADS_PREFER_PTHREAD_FLAG ON)
 find_package(Threads REQUIRED)
 
-option(BUILD_TESTS "Build Tests" OFF)
-
-if(BUILD_TESTS)
-    enable_testing()
-endif()
-
 if(APPLE)
     option(BUILD_STATIC_LOADER "Build a loader that can be statically linked" OFF)
 endif()
@@ -293,6 +287,7 @@ endif()
 
 add_subdirectory(loader)
 
+option(BUILD_TESTS "Build Tests")
 if(BUILD_TESTS)
     # Set gtest build configuration
     # Attempt to enable if it is available.
@@ -394,7 +389,7 @@ if(BUILD_TESTS)
     endif()
 
     if (BUILD_TESTS)
+        enable_testing()
         add_subdirectory(tests)
     endif()
-
 endif()