[cmake-developers] [CMake 0014913]: GTEST_ADD_TESTS doesn't use new signature ADD_TEST(NAME name COMMAND command): generated executable is then not found

Mantis Bug Tracker mantis at public.kitware.com
Mon May 12 12:08:54 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14913 
====================================================================== 
Reported By:                trsystran
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14913
Category:                   Modules
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-05-12 12:08 EDT
Last Modified:              2014-05-12 12:08 EDT
====================================================================== 
Summary:                    GTEST_ADD_TESTS doesn't use new signature
ADD_TEST(NAME name COMMAND command): generated executable is then not found
Description: 
GTEST_ADD_TESTS doesn't use new signature ADD_TEST(NAME name COMMAND command): 
>From 2.8.8 (and today's git master) FindGTest.cmake:

add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args})

generated executable is then not found:
Test project /home/.....
    Start 1: AUnitTest.Base
Could not find executable AUnitTest
Looked in the following places:
AUnitTest
AUnitTest
Release/AUnitTest
Release/AUnitTest
Debug/AUnitTest
Debug/AUnitTest
MinSizeRel/AUnitTest
MinSizeRel/AUnitTest
RelWithDebInfo/AUnitTest
RelWithDebInfo/AUnitTest
Deployment/AUnitTest
Deployment/AUnitTest
Development/AUnitTest
Development/AUnitTest
Unable to find executable: AUnitTest
1/4 Test http://www.cmake.org/Bug/view.php?id=1: AUnitTest.Base
..............***Not Run   0.00 sec


Steps to Reproduce: 
CMakeLists.txt:

set(AUnitTestSources
  Test.cc
  )

create_executable(AUnitTest
  ${AUnitTestSources}
  )

target_link_libraries(AUnitTest
  ${GTEST_BOTH_LIBRARIES}
  )

set(AUnitTestArgs "")
gtest_add_tests(AUnitTest
  "${AUnitTestArgs}"
  ${AUnitTestSources}
  )

Shell:
ctest -R "AUnitTest*"

Output:
"Could not find executable AUnitTest"

Additional Information: 
Using the old signature for add_test is the cause of the binary not found, see
bugs 14766, 12033, 8139.

By replacing the invocation of add_test by the following, it works:
add_test(NAME ${test_name} COMMAND ${executable} --gtest_filter=${test_name}
${extra_args})
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-05-12 12:08 trsystran      New Issue                                    
======================================================================



More information about the cmake-developers mailing list