D7187: RFC: Make ECMAddTests respect BUILD_TESTING

Kevin Funk noreply at phabricator.kde.org
Mon Aug 7 13:53:41 UTC 2017


kfunk created this revision.
Restricted Application added projects: Frameworks, Build System.
Restricted Application added subscribers: Build System, Frameworks.

REVISION SUMMARY
  Use-case: Make building unit tests optional, by just following the CMake
  BUILD_TESTING option.
  
  The usual approach to conditionally build tests is to do:
  
    if (BUILD_TESTING)
        add_executable(TestOne TestOne.cpp)
        target_link_libraries(TestOne my_library)
    endif()
  
  or:
  
    if (BUILD_TESTING)
        add_subdirectory(tests)
    endif()
  
  This patch just turns all calls to ecm_add_test(...) into no-ops if
  BUILD_TESTING=OFF.
  
  See:
  
    https://cmake.org/cmake/help/v3.6/module/CTest.html

REPOSITORY
  R240 Extra CMake Modules

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D7187

AFFECTED FILES
  modules/ECMAddTests.cmake
  modules/ECMEnableSanitizers.cmake

To: kfunk
Cc: #frameworks, #build_system
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170807/ce5c4bd8/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list