mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-17 07:11:52 +08:00
FindCxxTest: Add CxxTest_FOUND variable and update docs
- This module previously didn't define the CxxTest_FOUND result variable consistently if neither Python nor Perl were found. - Documentation is also updated a bit further to note that Perl-based test generator script has been removed in CxxTest version 4.0. - Internal comments synced. - Python_FOUND result variable used. Issue: #27242
This commit is contained in:
@@ -19,7 +19,9 @@ Result Variables
|
|||||||
|
|
||||||
This module defines the following variables:
|
This module defines the following variables:
|
||||||
|
|
||||||
``CXXTEST_FOUND``
|
``CxxTest_FOUND``
|
||||||
|
.. versionadded:: 4.2
|
||||||
|
|
||||||
Boolean indicating whether the CxxTest framework was found.
|
Boolean indicating whether the CxxTest framework was found.
|
||||||
|
|
||||||
``CXXTEST_INCLUDE_DIRS``
|
``CXXTEST_INCLUDE_DIRS``
|
||||||
@@ -39,11 +41,15 @@ Cache Variables
|
|||||||
|
|
||||||
The following cache variables may also be set:
|
The following cache variables may also be set:
|
||||||
|
|
||||||
|
``CXXTEST_PYTHON_TESTGEN_EXECUTABLE``
|
||||||
|
The path to the Python-based CxxTest test generator script.
|
||||||
|
|
||||||
``CXXTEST_PERL_TESTGEN_EXECUTABLE``
|
``CXXTEST_PERL_TESTGEN_EXECUTABLE``
|
||||||
The path to the Perl-based CxxTest test generator script.
|
The path to the Perl-based CxxTest test generator script.
|
||||||
|
|
||||||
``CXXTEST_PYTHON_TESTGEN_EXECUTABLE``
|
.. note::
|
||||||
The path to the Python-based CxxTest test generator script.
|
Perl-based test generator script has been removed in CxxTest version
|
||||||
|
4.0 in favor of Python-based script.
|
||||||
|
|
||||||
Hints
|
Hints
|
||||||
^^^^^
|
^^^^^
|
||||||
@@ -80,7 +86,7 @@ This module provides the following command if CxxTest is found:
|
|||||||
This must be a relative path. It is interpreted relative to the
|
This must be a relative path. It is interpreted relative to the
|
||||||
current binary directory (:variable:`CMAKE_CURRENT_BINARY_DIR`).
|
current binary directory (:variable:`CMAKE_CURRENT_BINARY_DIR`).
|
||||||
|
|
||||||
``<input-files-to-testgen>``
|
``<input-files-to-testgen>...``
|
||||||
A list of header files containing test suite classes derived from the C++
|
A list of header files containing test suite classes derived from the C++
|
||||||
class ``CxxTest::TestSuite``, to be included in the test runner. These must
|
class ``CxxTest::TestSuite``, to be included in the test runner. These must
|
||||||
be given as absolute paths.
|
be given as absolute paths.
|
||||||
@@ -88,7 +94,13 @@ This module provides the following command if CxxTest is found:
|
|||||||
Deprecated Variables
|
Deprecated Variables
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The following variables are deprecated and provided for backward compatibility:
|
The following variables are provided for backward compatibility:
|
||||||
|
|
||||||
|
``CXXTEST_FOUND``
|
||||||
|
.. deprecated:: 4.2
|
||||||
|
Use ``CxxTest_FOUND``, which has the same value.
|
||||||
|
|
||||||
|
Boolean indicating whether the CxxTest framework was found.
|
||||||
|
|
||||||
``CXXTEST_USE_PYTHON``
|
``CXXTEST_USE_PYTHON``
|
||||||
.. deprecated:: 2.8.3
|
.. deprecated:: 2.8.3
|
||||||
@@ -125,7 +137,7 @@ module. If CxxTest is found:
|
|||||||
find_package(CxxTest)
|
find_package(CxxTest)
|
||||||
|
|
||||||
# Create interface imported target:
|
# Create interface imported target:
|
||||||
if(CXXTEST_FOUND AND NOT TARGET CxxTest::CxxTest)
|
if(CxxTest_FOUND AND NOT TARGET CxxTest::CxxTest)
|
||||||
add_library(CxxTest::CxxTest INTERFACE IMPORTED)
|
add_library(CxxTest::CxxTest INTERFACE IMPORTED)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
CxxTest::CxxTest
|
CxxTest::CxxTest
|
||||||
@@ -134,7 +146,7 @@ module. If CxxTest is found:
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Add test:
|
# Add test:
|
||||||
if(CXXTEST_FOUND)
|
if(CxxTest_FOUND)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
cxxtest_add_test(
|
cxxtest_add_test(
|
||||||
@@ -168,8 +180,11 @@ module. If CxxTest is found:
|
|||||||
};
|
};
|
||||||
#]=======================================================================]
|
#]=======================================================================]
|
||||||
|
|
||||||
|
# CMake 4.2
|
||||||
|
# Module now consistently defines the CxxTest_FOUND result variable.
|
||||||
|
#
|
||||||
# Version 1.4 (11/18/10) (CMake 2.8.4)
|
# Version 1.4 (11/18/10) (CMake 2.8.4)
|
||||||
# Issue 11384: Added support to the CXX_ADD_TEST macro so header
|
# Issue 11384: Added support to the cxxtest_add_test() macro so header
|
||||||
# files (containing the tests themselves) show up in
|
# files (containing the tests themselves) show up in
|
||||||
# Visual Studio and other IDEs.
|
# Visual Studio and other IDEs.
|
||||||
#
|
#
|
||||||
@@ -181,17 +196,21 @@ module. If CxxTest is found:
|
|||||||
#
|
#
|
||||||
# Also added support for CXXTEST_TESTGEN_ARGS, for manually specifying
|
# Also added support for CXXTEST_TESTGEN_ARGS, for manually specifying
|
||||||
# options to the CxxTest code generator.
|
# options to the CxxTest code generator.
|
||||||
# Version 1.2 (3/2/08)
|
#
|
||||||
|
# Version 1.2 (3/2/08) (CMake 2.8.0)
|
||||||
# Included patch from Tyler Roscoe to have the perl & python binaries
|
# Included patch from Tyler Roscoe to have the perl & python binaries
|
||||||
# detected based on CXXTEST_INCLUDE_DIR
|
# detected based on CXXTEST_INCLUDE_DIR.
|
||||||
# Version 1.1 (2/9/08)
|
#
|
||||||
# Clarified example to illustrate need to call target_link_libraries()
|
# Version 1.1 (2/9/08) (CMake 2.8.0)
|
||||||
# Changed commands to lowercase
|
# Clarified example to illustrate need to call target_link_libraries().
|
||||||
# Added licensing info
|
# Changed commands to lowercase.
|
||||||
# Version 1.0 (1/8/08)
|
# Added licensing info.
|
||||||
# Fixed CXXTEST_INCLUDE_DIRS so it will work properly
|
#
|
||||||
# Eliminated superfluous CXXTEST_FOUND assignment
|
# Version 1.0 (1/8/08) (CMake 2.6.3)
|
||||||
# Cleaned up and added more documentation
|
# Module added to CMake.
|
||||||
|
# Fixed CXXTEST_INCLUDE_DIRS so it will work properly.
|
||||||
|
# Eliminated superfluous CXXTEST_FOUND assignment.
|
||||||
|
# Cleaned up and added more documentation.
|
||||||
|
|
||||||
#=============================================================
|
#=============================================================
|
||||||
# cxxtest_add_test (public macro)
|
# cxxtest_add_test (public macro)
|
||||||
@@ -218,7 +237,6 @@ macro(CXXTEST_ADD_TEST _cxxtest_testname _cxxtest_outfname)
|
|||||||
else()
|
else()
|
||||||
add_test(${_cxxtest_testname} ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_testname})
|
add_test(${_cxxtest_testname} ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_testname})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
#=============================================================
|
#=============================================================
|
||||||
@@ -238,10 +256,10 @@ find_program(CXXTEST_PYTHON_TESTGEN_EXECUTABLE
|
|||||||
find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl
|
find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl
|
||||||
PATHS ${CXXTEST_INCLUDE_DIR})
|
PATHS ${CXXTEST_INCLUDE_DIR})
|
||||||
|
|
||||||
if(PYTHON_FOUND OR Perl_FOUND)
|
if(Python_FOUND OR Perl_FOUND)
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
if(PYTHON_FOUND AND (CXXTEST_USE_PYTHON OR NOT Perl_FOUND OR NOT DEFINED CXXTEST_USE_PYTHON))
|
if(Python_FOUND AND (CXXTEST_USE_PYTHON OR NOT Perl_FOUND OR NOT DEFINED CXXTEST_USE_PYTHON))
|
||||||
set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE})
|
set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE})
|
||||||
execute_process(COMMAND ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE} --version
|
execute_process(COMMAND ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE} --version
|
||||||
OUTPUT_VARIABLE _CXXTEST_OUT ERROR_VARIABLE _CXXTEST_OUT RESULT_VARIABLE _CXXTEST_RESULT)
|
OUTPUT_VARIABLE _CXXTEST_OUT ERROR_VARIABLE _CXXTEST_OUT RESULT_VARIABLE _CXXTEST_RESULT)
|
||||||
@@ -260,13 +278,14 @@ if(PYTHON_FOUND OR Perl_FOUND)
|
|||||||
CXXTEST_INCLUDE_DIR CXXTEST_PERL_TESTGEN_EXECUTABLE)
|
CXXTEST_INCLUDE_DIR CXXTEST_PERL_TESTGEN_EXECUTABLE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CXXTEST_FOUND)
|
if(CxxTest_FOUND)
|
||||||
set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR})
|
set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
set(CxxTest_FOUND FALSE)
|
||||||
|
set(CXXTEST_FOUND ${CxxTest_FOUND})
|
||||||
|
|
||||||
set(CXXTEST_FOUND false)
|
|
||||||
if(NOT CxxTest_FIND_QUIETLY)
|
if(NOT CxxTest_FIND_QUIETLY)
|
||||||
if(CxxTest_FIND_REQUIRED)
|
if(CxxTest_FIND_REQUIRED)
|
||||||
message(FATAL_ERROR "Neither Python nor Perl found, cannot use CxxTest, aborting!")
|
message(FATAL_ERROR "Neither Python nor Perl found, cannot use CxxTest, aborting!")
|
||||||
|
Reference in New Issue
Block a user