MantisBT - CMake
View Issue Details
0014913CMakeModulespublic2014-05-12 12:082014-11-03 08:38
trsystran 
Rolf Eike Beer 
normalmajoralways
closedfixed 
CMake 2.8.8 
CMake 3.1CMake 3.1 
0014913: GTEST_ADD_TESTS doesn't use new signature ADD_TEST(NAME name COMMAND command): generated executable is then not found
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 #1: AUnitTest.Base ..............***Not Run 0.00 sec
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"
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})
No tags attached.
Issue History
2014-05-12 12:08trsystranNew Issue
2014-05-12 12:23Rolf Eike BeerNote Added: 0035851
2014-05-12 12:23Rolf Eike BeerAssigned To => Rolf Eike Beer
2014-05-12 12:23Rolf Eike BeerStatusnew => resolved
2014-05-12 12:23Rolf Eike BeerResolutionopen => fixed
2014-05-12 12:23Rolf Eike BeerOSLinux =>
2014-05-12 12:23Rolf Eike BeerOS VersionUbuntu 10.04 =>
2014-05-12 12:23Rolf Eike BeerPlatformIntel =>
2014-05-12 12:23Rolf Eike BeerFixed in Version => CMake 3.1
2014-05-12 12:23Rolf Eike BeerTarget Version => CMake 3.1
2014-11-03 08:38Robert MaynardNote Added: 0037136
2014-11-03 08:38Robert MaynardStatusresolved => closed

Notes
(0035851)
Rolf Eike Beer   
2014-05-12 12:23   
Fix merged to next: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=293bcf7a6059af2293ee4d3f0509fcaf1eb66f72 [^]
(0037136)
Robert Maynard   
2014-11-03 08:38   
Closing resolved issues that have not been updated in more than 4 months.