git repos / PlatformFolders

commit 11340f6c

Olivier LDff · 2021-08-16 13:19
11340f6c2daedd63b5bf1f094ac4da31a935e197 patch · browse files
parent bb58d995fb8503077e37d7dac0d1ed59c31652ab

Use scoped PLATFORMFOLDERS_BUILD_TESTING option instead of BUILD_TESTING
PLATFORMFOLDERS_BUILD_TESTING is defaulted to ON if platfrom_folders is main project

Changed files

M CMakeLists.txt before
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7786e3a..d5bee81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -10,6 +10,7 @@ project(platform_folders VERSION 4.1.0 LANGUAGES CXX)
# BUILD_SHARED_LIBS is off by default, the library will be static by default
option(PLATFORMFOLDERS_BUILD_SHARED_LIBS "Build platform_folders shared library" ${BUILD_SHARED_LIBS})
+option(PLATFORMFOLDERS_BUILD_TESTING "Build platform_folders tests" ${PLATFORMFOLDERS_MAIN_PROJECT})
option(PLATFORMFOLDERS_ENABLE_INSTALL "Enable platform_folders INSTALL target" ${PLATFORMFOLDERS_MAIN_PROJECT})
set(PLATFORMFOLDERS_TYPE STATIC)
@@ -119,10 +120,8 @@ if(PLATFORMFOLDERS_ENABLE_INSTALL)
)
endif()
-# A module for testing the library
-include(CTest)
-# BUILD_TESTING is defined (default ON) in CTest
-if(BUILD_TESTING)
+if(PLATFORMFOLDERS_BUILD_TESTING)
+ enable_testing()
add_subdirectory(test)
add_executable(platform_folders_sample platform_folders.cpp)
target_link_libraries(platform_folders_sample PRIVATE platform_folders)