From 1b636b43d2bf4dca0332a2e2b36affa67fbe1e0b Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Mon, 11 May 2015 13:56:28 +0100 Subject: Add unit tests for ECMAddTests module. REVIEW: 123722 --- modules/ECMAddTests.cmake | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'modules/ECMAddTests.cmake') diff --git a/modules/ECMAddTests.cmake b/modules/ECMAddTests.cmake index de06315d..bdb60691 100644 --- a/modules/ECMAddTests.cmake +++ b/modules/ECMAddTests.cmake @@ -23,9 +23,13 @@ # give an indication of where to look for a failing test. # # If the flag GUI is passed the test binary will be a GUI executable, otherwise -# the resulting binary will be a console application. The test will be linked +# the resulting binary will be a console application (regardless of the value +# of CMAKE_WIN32_EXECUTABLE or CMAKE_MACOSX_BUNDLE). The test will be linked # against the libraries and/or targets passed to LINK_LIBRARIES. # +# The generated target executable will have the effects of ecm_mark_as_test() +# (from the :module:`ECMMarkAsTest` module) applied to it. +# # # :: # @@ -52,6 +56,7 @@ # (To distribute this file outside of extra-cmake-modules, substitute the full # License text for the above reference.) +include(CMakeParseArguments) include(ECMMarkAsTest) include(ECMMarkNonGuiExecutable) @@ -73,7 +78,11 @@ function(ecm_add_test) endif() set(_testname "${ECM_ADD_TEST_NAME_PREFIX}${_targetname}") - add_executable(${_targetname} ${_sources}) + set(gui_args) + if(ECM_ADD_TEST_GUI) + set(gui_args WIN32 MACOSX_BUNDLE) + endif() + add_executable(${_targetname} ${gui_args} ${_sources}) if(NOT ECM_ADD_TEST_GUI) ecm_mark_nongui_executable(${_targetname}) endif() -- cgit v1.2.1