MantisBT - CMake
View Issue Details
0011041CMakeModulespublic2010-07-27 05:432010-11-09 22:58
Droscy 
Philip Lowman 
normalfeatureN/A
closedfixed 
CMake-2-8 
CMake 2.8.3CMake 2.8.3 
0011041: FindCxxTest doesn't look for Python or Perl, but CxxTest requires one of them (patch attached)
FindCxxTest doesn't look for Python or Perl, but CxxTest requires one of them. The attached patch implements
- find_package(PythonInterp QUIET)
- find_package(Perl QUIET)
and set the right generator using the user preference (CXXTEST_USE_PYTHON) and the found interpreter.
No tags attached.
patch search_python_and_perl.patch (3,984) 2010-07-27 05:43
https://public.kitware.com/Bug/file/3274/search_python_and_perl.patch
patch search_python_and_perl_new01.patch (4,074) 2010-07-31 07:56
https://public.kitware.com/Bug/file/3288/search_python_and_perl_new01.patch
? FindCxxTest.cmake (6,902) 2010-08-15 19:13
https://public.kitware.com/Bug/file/3320/FindCxxTest.cmake
Issue History
2010-07-27 05:43DroscyNew Issue
2010-07-27 05:43DroscyFile Added: search_python_and_perl.patch
2010-07-31 02:53Kovarththanan RajaratnamNote Added: 0021583
2010-07-31 07:56DroscyNote Added: 0021584
2010-07-31 07:56DroscyFile Added: search_python_and_perl_new01.patch
2010-08-02 15:29Philip LowmanStatusnew => assigned
2010-08-02 15:29Philip LowmanAssigned To => Philip Lowman
2010-08-15 19:05Philip LowmanFile Added: FindCxxTest.cmake
2010-08-15 19:13Philip LowmanNote Added: 0021764
2010-08-15 19:13Philip LowmanFile Deleted: FindCxxTest.cmake
2010-08-15 19:13Philip LowmanFile Added: FindCxxTest.cmake
2010-08-18 08:24DroscyNote Added: 0021802
2010-08-18 23:17Philip LowmanNote Added: 0021817
2010-08-19 21:47Philip LowmanNote Added: 0021855
2010-08-19 21:47Philip LowmanStatusassigned => resolved
2010-08-19 21:47Philip LowmanResolutionopen => fixed
2010-09-01 00:25Philip LowmanNote Added: 0022048
2010-09-01 00:25Philip LowmanStatusresolved => assigned
2010-09-01 00:25Philip LowmanTarget Version => CMake 2.8.3
2010-09-01 00:27Philip LowmanNote Added: 0022049
2010-09-01 00:27Philip LowmanStatusassigned => resolved
2010-09-01 00:27Philip LowmanFixed in Version => CMake 2.8.3
2010-11-09 22:58Philip LowmanStatusresolved => closed

Notes
(0021583)
Kovarththanan Rajaratnam   
2010-07-31 02:53   
Thanks for the patch. Sadly the patch isn't backwards compatible. CXXTEST_PYTHON_TESTGEN_EXECUTABLE and CXXTEST_PERL_TESTGEN_EXECUTABLE has been removed. Can you rework the patch to retain CXXTEST_PYTHON_TESTGEN_EXECUTABLE and CXXTEST_PERL_TESTGEN_EXECUTABLE?
(0021584)
Droscy   
2010-07-31 07:56   
Yes, of course, you are right, I forgot that "MUST".
Attached the new patch:
- CXXTEST_PYTHON_TESTGEN_EXECUTABLE and CXXTEST_PERL_TESTGEN_EXECUTABLE are still present
- CXXTEST_TESTGEN_EXECUTABLE points to the used generator
(0021764)
Philip Lowman   
2010-08-15 19:13   
I've merged Droscy's patch into the attached versions and made some additional improvements.

Some additional changes...
1. I've removed the warning if CXXTEST_USE_PYTHON is set wrong. The system now automatically uses python or perl if they are the only interpreter detected. The CXXTEST_USE_PYTHON variable is only used now if both interpreters are detected.
2. The interpreter that is being used (perl | python) is used to run the script now.

Feedback and testing would be appreciated.
(0021802)
Droscy   
2010-08-18 08:24   
Hi Philip,
I think that your version is not fully backward compatible because if, for some reason, a user uses Python for the macro CXXTEST_ADD_TEST but uses also CXXTEST_PERL_TESTGEN_EXECUTABLE for manually creating a test suite, this behaviour is no more possible because CXXTEST_PERL_TESTGEN_EXECUTABLE is not set.

Let me explain better, consider the following code (Python and Perl both present):
   set(CXXTEST_USE_PYTHON true)
   find_package(CxxTest)
   cxxtest_add_test(...) # python used
   add_custom_command(
      OUTPUT ${myoutput}
      COMMAND ${CXXTEST_PERL_TESTGEN_EXECUTABLE})
this will no work any more: CXXTEST_PERL_TESTGEN_EXECUTABLE is not set.

The same problem if the code is:
   find_package(CxxTest)
   cxxtest_add_test(...) # perl used
   add_custom_command(
      OUTPUT ${myoutput}
      COMMAND ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE})
because CXXTEST_PYTHON_TESTGEN_EXECUTABLE is not set.

Probably it's better to set both
  CXXTEST_PERL_TESTGEN_EXECUTABLE
  CXXTEST_PYTHON_TESTGEN_EXECUTABLE
independently from the actually used generator in the macro CXXTEST_ADD_TEST and provide, as the script already does, a variable with the used generator. So the user can let the macro choose and can also manually use the other generator.

Maybe I've misunderstood your code, am I right?
(0021817)
Philip Lowman   
2010-08-18 23:17   
Yeah, that thought occurred to me too, the day after I uploaded the file. I will amend the code to always set both CXXTEST_PERL_TESTGEN_EXECUTABLE & CXXTEST_PYTHON_TESTGEN_EXECUTABLE. I'll post here when the code has been checked in. Thanks for the patch and opening the ticket.
(0021855)
Philip Lowman   
2010-08-19 21:47   
Will be in 2.8.3

To git@cmake.org:stage/cmake.git
 * [new branch] HEAD -> FindCxxTest_11041
(0022048)
Philip Lowman   
2010-09-01 00:25   
Reopening to set "Target Release" / "Fixed In Version" fields
(0022049)
Philip Lowman   
2010-09-01 00:27   
Fix checked into cmake.git master
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ed78a72a9b3b199e2c3ae55da7e8fe37b07a65ca [^]